fix: set the correct image source type based on label

We also have a special carveout for herokuish as folks may deploy built images with it.
This commit is contained in:
Jose Diaz-Gonzalez committed 2022-08-09 02:11:32 -04:00
1 parent 30e279b6b9
commit a71e4219be
1 file changed
+25 -4
+25 -4
View File
@@ -330,6 +330,29 @@ get_running_image_tag() {
echo "$IMAGE_TAG" echo "$IMAGE_TAG"
} }
get_image_builder_type() {
declare desc="returns the image builder_type"
declare IMAGE="$1" APP="$2"
if [[ -z "$IMAGE" ]]; then
echo "dockerfile"
return
fi
BUILDER_TYPE="$("$DOCKER_BIN" image inspect --format '{{ index .Config.Labels "com.dokku.builder-type" }}' "$IMAGE")"
if [[ -n "$BUILDER_TYPE" ]]; then
echo "$BUILDER_TYPE"
return
fi
if is_image_herokuish_based "$IMAGE" "$APP"; then
echo "herokuish"
return
fi
echo "dockerfile"
}
is_image_cnb_based() { is_image_cnb_based() {
declare desc="returns true if app image is based on cnb" declare desc="returns true if app image is based on cnb"
declare IMAGE="$1" declare IMAGE="$1"
@@ -662,10 +685,8 @@ release_and_deploy() {
local DOKKU_DOCKERFILE_PORTS local DOKKU_DOCKERFILE_PORTS
if verify_image "$IMAGE"; then if verify_image "$IMAGE"; then
if is_image_herokuish_based "$IMAGE" "$APP"; then IMAGE_SOURCE_TYPE="$(get_image_builder_type "$IMAGE" "$APP")"
local IMAGE_SOURCE_TYPE="herokuish" if [[ "$IMAGE_SOURCE_TYPE" == "dockerfile" ]]; then
else
local IMAGE_SOURCE_TYPE="dockerfile"
DOKKU_DOCKERFILE_PORTS=$(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true) DOKKU_DOCKERFILE_PORTS=$(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true)
if [[ -z "$DOKKU_DOCKERFILE_PORTS" ]]; then if [[ -z "$DOKKU_DOCKERFILE_PORTS" ]]; then
local DOCKER_IMAGE_PORTS=$(get_exposed_ports_from_image "$IMAGE") local DOCKER_IMAGE_PORTS=$(get_exposed_ports_from_image "$IMAGE")