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

Feat: Add latest tag build and push #8

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Changes from 1 commit
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
9 changes: 7 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_ONLY_LATEST=$(projectEnvironmentVariableCheck BUILDER_ONLY_LATEST "0")
shreddedbacon marked this conversation as resolved.
Show resolved Hide resolved

# 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,10 @@ 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}"
docker push "${BUILDER_BACKUP_IMAGE_NAME}:latest"
if [ "$BUILDER_ONLY_LATEST" == "0" ]; then
docker push "${backup_image_full}"
fi

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