Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an additional tag for docker images in push hook script #462

Merged
merged 6 commits into from
Nov 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions build/install/docker/hooks/push
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#!/bin/bash
export DOCKER_TAG=$DOCKER_TAG
BASE_NAME="appserver"
BUILD_NUMBER="$(date "+%Y%m%d%H")"
docker-compose -f build.yml push

# Get docker images name to array
arrayImagesName=($(docker image ls | grep "$DOCKER_TAG" | grep "$STATUS" | grep "$BASE_NAME" | awk '{print $1}' ))

# Modify docker image tag
for i in ${!arrayImagesName[@]}; do
echo " Modify ${arrayImagesName[$i]}:$DOCKER_TAG "
docker image tag ${arrayImagesName[$i]}:$DOCKER_TAG ${arrayImagesName[$i]}:$DOCKER_TAG-$BUILD_NUMBER
done

# Push the same images with a new tag
DOCKER_TAG=$DOCKER_TAG-$BUILD_NUMBER
docker-compose -f build.yml push