Skip to content

Commit

Permalink
Merge pull request #8 from steveworley/feat/build-latest-tag
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon authored Nov 29, 2023
2 parents 2256121 + 9334388 commit 68e5732
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mariadb-image-builder
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ BUILDER_DOCKER_HOST=$(projectEnvironmentVariableCheck BUILDER_DOCKER_HOST "${BUI

BUILDER_MTK_YAML_BASE64=$(projectEnvironmentVariableCheck BUILDER_MTK_YAML_BASE64 "${BUILDER_MTK_YAML_BASE64}")

# optional
BUILDER_PUSH_TAGS=$(projectEnvironmentVariableCheck BUILDER_PUSH_TAGS "both")

# check the pattern
if [ -z $BUILDER_BACKUP_IMAGE_NAME ]; then
Expand Down Expand Up @@ -255,7 +257,7 @@ done

# build the image
ln -s mariadb.Dockerfile Dockerfile
docker build --network=host --build-arg BUILDER_IMAGE="${BUILDER_IMAGE_NAME}" --build-arg CLEAN_IMAGE="${BUILDER_CLEAN_IMAGE_NAME}" -t ${backup_image_full} .
docker build --network=host --build-arg BUILDER_IMAGE="${BUILDER_IMAGE_NAME}" --build-arg CLEAN_IMAGE="${BUILDER_CLEAN_IMAGE_NAME}" -t ${backup_image_full} -t "${BUILDER_BACKUP_IMAGE_NAME}:latest" .

##### Phase 4: Save new container to registry

Expand All @@ -275,7 +277,13 @@ echo "=== Phase 4: Save new container to registry ==="
echo $BUILDER_REGISTRY_PASSWORD | docker login ${BUILDER_REGISTRY_HOST} -u "$BUILDER_REGISTRY_USERNAME" --password-stdin

# Push the image to remote
docker push "${backup_image_full}"
if [ "$BUILDER_PUSH_TAGS" == "both" ] || [ "$BUILDER_PUSH_TAGS" == "latest" ]; then
docker push "${BUILDER_BACKUP_IMAGE_NAME}:latest"
fi

if [ "$BUILDER_PUSH_TAGS" == "both" ] || [ "$BUILDER_PUSH_TAGS" == "default" ]; then
docker push "${backup_image_full}"
fi

echo
echo "========================"
Expand Down

0 comments on commit 68e5732

Please sign in to comment.