Commit b8e00b98 by Edward Thomson

ci: cache docker layers

Our docker builds are getting expensive, let's cache some of this.
parent 6df3ec4a
......@@ -4,9 +4,19 @@ steps:
- script: docker run --rm --privileged multiarch/qemu-user-static:register --reset
displayName: 'Register Docker QEMU'
- task: cache@2
displayName: Cache Docker layers
inputs:
key: docker
path: /tmp/dockercache
- script: |
if [ -f /tmp/dockercache/${{parameters.docker.image}}.tar ]; then docker load < /tmp/dockercache/${{parameters.docker.image}}.tar; fi
displayName: 'Load Docker cache'
- script: |
cd $(Build.SourcesDirectory)/azure-pipelines/docker
docker build -t libgit2/${{parameters.docker.image}} --build-arg BASE=${{parameters.docker.base}} -f ${{parameters.docker.image}} .
if [ ! -d /tmp/dockercache ]; then mkdir /tmp/dockercache; fi
docker save libgit2/${{parameters.docker.image}} $(docker history -q libgit2/${{parameters.docker.image}} | grep -v '<missing>') > /tmp/dockercache/${{parameters.docker.image}}.tar
displayName: 'Build Docker image'
- task: docker@0
displayName: Build
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment