From a42786a465d0c6a6beed06baff59048d9af9210f Mon Sep 17 00:00:00 2001 From: Milan Vit Date: Thu, 10 Dec 2020 08:17:11 +0900 Subject: [PATCH] Fixes tags:deploy command for images that contain ONBUILD directive Fixes #4226 --- plugins/builder-dockerfile/builder-release | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/builder-dockerfile/builder-release b/plugins/builder-dockerfile/builder-release index 5f078cf8bc3..3cfff9af096 100755 --- a/plugins/builder-dockerfile/builder-release +++ b/plugins/builder-dockerfile/builder-release @@ -15,7 +15,11 @@ trigger-builder-dockerfile-builder-release() { plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG" local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG") - echo "FROM $IMAGE" | suppress_output "$DOCKER_BIN" image build --label=com.dokku.image-stage=release --label=com.dokku.app-name=$APP --label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku -t "$IMAGE" - + if "$DOCKER_BIN" image history --format "{{ json . }}" "$IMAGE" | grep -q "ONBUILD"; then + dokku_log_warn "Image contains ONBUILD directive(s), skipping re-labeling" + else + echo "FROM $IMAGE" | suppress_output "$DOCKER_BIN" image build --label=com.dokku.image-stage=release --label=com.dokku.app-name=$APP --label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku -t "$IMAGE" - + fi plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG" }