[#699] Build images only when non snapshot

This commit is contained in:
Rahul De 2021-01-03 14:29:19 +01:00
parent 7b1e9cbe62
commit 8b61d855a8
No known key found for this signature in database
GPG key ID: 4435E700B66BA90F
2 changed files with 24 additions and 12 deletions

View file

@ -21,20 +21,26 @@ if [ -z "$CIRCLE_PULL_REQUEST" ] && [ "$CIRCLE_BRANCH" = "master" ]; then
docker build -t "$image_name" -f Dockerfile.ci .
docker tag "$image_name:$latest_tag" "$image_name:$image_tag"
rm -f bb
unzip "/tmp/release/babashka-${image_tag}-linux-static-amd64.zip"
docker build -t "$image_name:alpine" -f Dockerfile.alpine .
docker tag "$image_name:alpine" "$image_name:$image_tag-alpine"
if [[ $snapshot == "false" ]]; then
unzip "/tmp/release/babashka-${image_tag}-linux-static-amd64.zip"
docker build -t "$image_name:alpine" -f Dockerfile.alpine .
docker tag "$image_name:alpine" "$image_name:$image_tag-alpine"
fi
# we only update latest when it's not a SNAPSHOT version
if [ "false" = "$snapshot" ]; then
echo "Pushing image $image_name:$latest_tag"
docker push "$image_name:$latest_tag"
echo "Pushing image $image_name:alpine"
docker push "$image_name:alpine"
if [[ $snapshot == "false" ]]; then
echo "Pushing image $image_name:alpine"
docker push "$image_name:alpine"
fi
fi
# we update the version tag, even if it's a SNAPSHOT version
echo "Pushing image $image_name:$image_tag"
docker push "$image_name:$image_tag"
docker push "$image_name:$image_tag-alpine"
if [[ $snapshot == "false" ]]; then
docker push "$image_name:$image_tag-alpine"
fi
else
echo "Not publishing Docker image"
fi

18
.github/script/docker vendored
View file

@ -23,20 +23,26 @@ then
docker build -t "$image_name" -f Dockerfile.ci .
docker tag "$image_name:$latest_tag" "$image_name:$image_tag"
rm -f bb
unzip "/tmp/release/babashka-${image_tag}-linux-static-amd64.zip"
docker build -t "$image_name:alpine" -f Dockerfile.alpine .
docker tag "$image_name:alpine" "$image_name:$image_tag-alpine"
if [[ $snapshot == "false" ]]; then
unzip "/tmp/release/babashka-${image_tag}-linux-static-amd64.zip"
docker build -t "$image_name:alpine" -f Dockerfile.alpine .
docker tag "$image_name:alpine" "$image_name:$image_tag-alpine"
fi
# we only update latest when it's not a SNAPSHOT version
if [ "false" = "$snapshot" ]; then
echo "Pushing image $image_name:$latest_tag"
docker push "$image_name:$latest_tag"
echo "Pushing image $image_name:alpine"
docker push "$image_name:alpine"
if [[ $snapshot == "false" ]]; then
echo "Pushing image $image_name:alpine"
docker push "$image_name:alpine"
fi
fi
# we update the version tag, even if it's a SNAPSHOT version
echo "Pushing image $image_name:$image_tag"
docker push "$image_name:$image_tag"
docker push "$image_name:$image_tag-alpine"
if [[ $snapshot == "false" ]]; then
docker push "$image_name:$image_tag-alpine"
fi
else
echo "Not publishing Docker image"
fi