File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -101,10 +101,18 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
101
101
# It seems that it cannot be the same as $IMAGE_TAG, otherwise it overwrites the cache
102
102
CACHE_IMAGE_TAG=${REGISTRY} /${REGISTRY_USERNAME} /rust-ci-cache:${cksum}
103
103
104
- # On non-CI jobs, we don't do any caching.
104
+ # On non-CI jobs, we try to download a pre-built image from the rust-lang-ci
105
+ # ghcr.io registry. If it is not possible, we fall back to building the image
106
+ # locally.
105
107
if ! isCI;
106
108
then
107
- retry docker build --rm -t rust-ci -f " $dockerfile " " $context "
109
+ if docker pull " ${IMAGE_TAG} " ; then
110
+ echo " Downloaded Docker image from CI"
111
+ docker tag " ${IMAGE_TAG} " rust-ci
112
+ else
113
+ echo " Building local Docker image"
114
+ retry docker build --rm -t rust-ci -f " $dockerfile " " $context "
115
+ fi
108
116
# On PR CI jobs, we don't have permissions to write to the registry cache,
109
117
# but we can still read from it.
110
118
elif [[ " $PR_CI_JOB " == " 1" ]];
You can’t perform that action at this time.
0 commit comments