-
Notifications
You must be signed in to change notification settings - Fork 20
/
deploy-multi-arch.sh
executable file
·36 lines (28 loc) · 1007 Bytes
/
deploy-multi-arch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/bash -e
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ $BRANCH == "master" ]] ; then
TARGET_TAG=$(sed -e '/^version=/!d' -e 's/version=//' -e 's/-SNAPSHOT/.BUILD-SNAPSHOT/' < gradle.properties)
elif [[ $BRANCH =~ RELEASE$ ]] ; then
TARGET_TAG=$BRANCH
elif [[ $BRANCH =~ M[0-9]+$ ]] ; then
TARGET_TAG=$BRANCH
elif [[ $BRANCH =~ RC[0-9]+$ ]] ; then
TARGET_TAG=$BRANCH
else
TARGET_TAG=${BRANCH}-${CIRCLE_BUILD_NUM?}
fi
docker login -u ${DOCKER_USER_ID?} -p ${DOCKER_PASSWORD?}
retag() {
BASE=$1
IMAGE=${BASE}:${MULTI_ARCH_TAG?}
TARGET_IMAGE=$BASE:$TARGET_TAG
echo Retagging $IMAGE $TARGET_IMAGE
SOURCES=$(docker manifest inspect $IMAGE | \
jq -r '.manifests[].digest | sub("^"; "'${BASE}'@")')
docker buildx imagetools create -t ${TARGET_IMAGE} $SOURCES
}
retag "eventuateio/eventuate-mysql8"
retag "eventuateio/eventuate-postgres"
retag "eventuateio/eventuate-vanilla-mysql8"
retag "eventuateio/eventuate-zookeeper"
retag "eventuateio/eventuate-vanilla-postgres"