diff --git a/mariadb-image-builder b/mariadb-image-builder index 784b66c..461748f 100644 --- a/mariadb-image-builder +++ b/mariadb-image-builder @@ -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 @@ -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 @@ -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 "========================"