Skip to content
Snippets Groups Projects

L2SS-232: Add a Docker tag/push script for local images

Merged Thomas Juerges requested to merge L2SS-232-Docker_tag_and_push_script into master
1 file
+ 40
0
Compare changes
  • Side-by-side
  • Inline
+ 40
0
#! /usr/bin/env bash -e
# Tag and push which image version?
DOCKER_TAG=latest
# Change to git tag or git hash if no tag
VERSION=$(date +"%Y-%M-%d")
SKA_REPO="nexus.engageska-portugal.pt/ska-docker"
LOFAR_REPO="git.astron.nl:5000/lofar2.0/tango"
# Compile a list of the SKA images
SKA_IMAGES=$(for i in $(docker images | egrep ${DOCKER_TAG} | egrep ${SKA_REPO} | cut -d' ' -f1); do printf "%s " ${i}; done)
# Compile a list of LOFAR2.0 images
LOFAR_IMAGES=$(for i in $(docker images | egrep ${DOCKER_TAG} | egrep -v "${SKA_REPO}|${LOFAR_REPO}" | cut -d' ' -f1); do printf "%s " ${i}; done)
function tag_and_push()
{
(
docker tag ${1} ${2}
docker push ${2}
) &
}
# Rename the SKA images for the LOFAR2.0 repo
# and push them to the LOFAR2.0 repo
for IMAGE in ${SKA_IMAGES}; do
PUSH_IMAGE=${IMAGE//${SKA_REPO}/${LOFAR_REPO}}:${VERSION}
tag_and_push ${IMAGE} ${PUSH_IMAGE}
done
# Rename the LOFAR2.0 images for the LOFAR2.0 repo
# and push them to the LOFAR2.0 repo
for IMAGE in ${LOFAR_IMAGES}; do
PUSH_IMAGES=${LOFAR_REPO}/${IMAGE}:${VERSIN}
tag_and_push ${IMAGE} ${PUSH_IMAGE}
done
wait
Loading