Commit cac2df9a authored by Louis Gesbert's avatar Louis Gesbert
Browse files

Use 'crane' to sync images to Docker hub

rather than Docker
parent c976394d
Pipeline #12452 passed with stages
in 3 minutes
......@@ -45,7 +45,9 @@ build-images:
publish-docker:
stage: publish
image: docker:latest
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [""]
variables:
DOCKERHUB_IMAGE: ocamlpro/ocaml
before_script:
......@@ -64,19 +66,13 @@ publish-docker:
}" > /root/.docker/config.json
script:
- for OCAML_VERSION in $(cat ocaml-versions); do
BASETAG=${OCAML_VERSION%.*}-$(date +%F);
SRC_IMG=$CI_REGISTRY_IMAGE:$BASETAG;
docker pull $SRC_IMG;
for TAG in
${BASETAG}
${OCAML_VERSION}
${OCAML_VERSION%.*}
$([ "$OCAML_VERSION" = $(tail -n1 ocaml-versions) ] && echo "latest")
; do
docker tag $SRC_IMG $DOCKERHUB_IMAGE:${TAG};
docker push $DOCKERHUB_IMAGE:${TAG};
done;
docker rmi $SRC_IMG;
TAG=${OCAML_VERSION%.*}-$(date +%F);
crane copy $CI_REGISTRY_IMAGE:$TAG $DOCKERHUB_IMAGE:$TAG;
crane tag $DOCKERHUB_IMAGE:$TAG ${OCAML_VERSION};
crane tag $DOCKERHUB_IMAGE:$TAG ${OCAML_VERSION%.*};
if [ "$OCAML_VERSION" = $(tail -n1 ocaml-versions) ]; then
crane tag $DOCKERHUB_IMAGE:$TAG latest;
fi;
done
only:
- master
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