I'm building an ASP.NET app using docker build
; when I run the build on my local machine, it quickly executes because I'm making use of the Build cache.
Step 1/10 : FROM microsoft/aspnetcore-build:2.0.0 as identity-build
---> c5549d4c5716
Step 2/10 : ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
---> Using cache
---> 060911817d8c
Step 3/10 : WORKDIR /publish
---> Using cache
---> 851e87c05c42
I'm trying to do the same on an AppVeyor CI, but because AppVeyor gives me a clean VM image for every build, there is no cache.
I've tried experimenting with pulling the build images from a private container repository, but this does not seem to "rehydrate the image cache", as a result, there are no cache hits.
I've created an example GitHub repo, and an associated build in AppVeyor with which I'm experimenting.
I've tried to restore the build images from a private container repository, but this has not resulted in any cache hits.
I'm trying to achieve two objectives by using the docker build cache.
First of all, I'm just trying to get the build cache rehydrated, and continue experimenting from there.
It seems the combination of a good night's sleep and the act of trying to compose this question has helped my Google-fu, as I've now found the answer :-)
docker build
can be instructed to use an image for its cache with the --cache-from
parameter.
For example (taken from here)
docker pull myimage:v1.0
docker build --cache-from myimage:v1.0 -t myimage:v1.1 .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With