diff --git a/bin/build.sh b/bin/build.sh index ae0f3d2f..6be57ae2 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -16,11 +16,14 @@ write_package_list() { docker run --rm "$image_tag" dpkg-query --show --showformat='${Package}\n' >> "$output_file" } +# Create buildx driver +docker buildx create --use + RUN_IMAGE_TAG="heroku/heroku:${STACK_VERSION}" RUN_DOCKERFILE_DIR="heroku-${STACK_VERSION}" [[ -d "${RUN_DOCKERFILE_DIR}" ]] || abort "fatal: directory ${RUN_DOCKERFILE_DIR} not found" display "Building ${RUN_DOCKERFILE_DIR} / ${RUN_IMAGE_TAG} Heroku runtime image" -docker build --pull --tag "${RUN_IMAGE_TAG}" "${RUN_DOCKERFILE_DIR}" | indent +docker buildx build --pull --platform=linux/arm64,linux/amd64 --tag "${RUN_IMAGE_TAG}" --push "${RUN_DOCKERFILE_DIR}" | indent write_package_list "${RUN_IMAGE_TAG}" "${RUN_DOCKERFILE_DIR}" # The --pull option is not used for variants to ensure they are based on the @@ -29,7 +32,7 @@ write_package_list "${RUN_IMAGE_TAG}" "${RUN_DOCKERFILE_DIR}" BUILD_IMAGE_TAG="${RUN_IMAGE_TAG}-build" BUILD_DOCKERFILE_DIR="${RUN_DOCKERFILE_DIR}-build" display "Building ${BUILD_DOCKERFILE_DIR} / ${BUILD_IMAGE_TAG} Heroku build-time image" -docker build --tag "$BUILD_IMAGE_TAG" "$BUILD_DOCKERFILE_DIR" | indent +docker buildx build --platform=linux/arm64,linux/amd64 --tag "$BUILD_IMAGE_TAG" --push "$BUILD_DOCKERFILE_DIR" | indent write_package_list "$BUILD_IMAGE_TAG" "$BUILD_DOCKERFILE_DIR" # write_package_list is not needed for *cnb* variants, as they don't install @@ -38,12 +41,12 @@ write_package_list "$BUILD_IMAGE_TAG" "$BUILD_DOCKERFILE_DIR" CNB_RUN_IMAGE_TAG="${RUN_IMAGE_TAG}-cnb" CNB_RUN_DOCKERFILE_DIR="${RUN_DOCKERFILE_DIR}-cnb" display "Building ${CNB_RUN_DOCKERFILE_DIR} / ${CNB_RUN_IMAGE_TAG} CNB runtime image" -docker build --tag "$CNB_RUN_IMAGE_TAG" "$CNB_RUN_DOCKERFILE_DIR" | indent +docker buildx build --platform=linux/arm64,linux/amd64 --tag "$CNB_RUN_IMAGE_TAG" --push "$CNB_RUN_DOCKERFILE_DIR" | indent CNB_BUILD_IMAGE_TAG="${RUN_IMAGE_TAG}-cnb-build" CNB_BUILD_DOCKERFILE_DIR="${RUN_DOCKERFILE_DIR}-cnb-build" display "Building ${CNB_BUILD_DOCKERFILE_DIR} / ${CNB_BUILD_IMAGE_TAG} CNB build-time image" -docker build --tag "$CNB_BUILD_IMAGE_TAG" "$CNB_BUILD_DOCKERFILE_DIR" | indent +docker buildx build --platform=linux/arm64,linux/amd64 --tag "$CNB_BUILD_IMAGE_TAG" --push "$CNB_BUILD_DOCKERFILE_DIR" | indent display "Size breakdown..." docker images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" \ diff --git a/bin/publish-to-registries.sh b/bin/publish-to-registries.sh index 0d8fd86f..f50568c0 100755 --- a/bin/publish-to-registries.sh +++ b/bin/publish-to-registries.sh @@ -3,8 +3,6 @@ set -euo pipefail set -x -bin/build.sh "${STACK_VERSION}" - ( # Disable tracing (until the end of this subshell) to prevent logging registry tokens. set +x @@ -18,14 +16,19 @@ bin/build.sh "${STACK_VERSION}" | docker login "$INTERNAL_REGISTRY_HOST" -u "$INTERNAL_REGISTRY_USERNAME" --password-stdin ) +bin/build.sh "${STACK_VERSION}" + push_group() { local targetTagBase="$1" local targetTagSuffix="$2" for variant in "" "-build" "-cnb" "-cnb-build"; do source="${publicTag}${variant}" target="${targetTagBase}${variant}${targetTagSuffix}" - docker tag "${source}" "${target}" - docker push "${target}" + chmod +r "$HOME"/.docker/config.json + docker container run --rm --net host \ + -v regctl-conf:/home/appuser/.regctl/ \ + -v "$HOME"/.docker/config.json:/home/appuser/.docker/config.json \ + regclient/regctl image copy "${source}" "${target}" done } diff --git a/heroku-20/Dockerfile b/heroku-20/Dockerfile index 013a998d..cd311d82 100644 --- a/heroku-20/Dockerfile +++ b/heroku-20/Dockerfile @@ -1,3 +1,4 @@ FROM ubuntu:20.04 +ARG TARGETARCH COPY setup.sh /tmp/setup.sh RUN /tmp/setup.sh diff --git a/heroku-20/setup.sh b/heroku-20/setup.sh index 2acd2a7d..049815da 100755 --- a/heroku-20/setup.sh +++ b/heroku-20/setup.sh @@ -10,9 +10,12 @@ export DEBIAN_FRONTEND=noninteractive # The default sources list minus backports, restricted and multiverse. cat >/etc/apt/sources.list < /etc/ImageMagick-6/policy.xml <<'IMAGEMAGICK_POLICY' diff --git a/heroku-22-build/setup.sh b/heroku-22-build/setup.sh index f4b28b64..d1b6f794 100755 --- a/heroku-22-build/setup.sh +++ b/heroku-22-build/setup.sh @@ -63,7 +63,7 @@ apt-get install -y --no-install-recommends \ libonig-dev \ libpam0g-dev \ libpopt-dev \ - libpq-dev \ + libpq-dev=15.1-1.pgdg22.04+1 \ librabbitmq-dev \ libreadline-dev \ librtmp-dev \ diff --git a/heroku-22/Dockerfile b/heroku-22/Dockerfile index 35da0384..6760c094 100644 --- a/heroku-22/Dockerfile +++ b/heroku-22/Dockerfile @@ -1,3 +1,4 @@ FROM ubuntu:22.04 +ARG TARGETARCH COPY setup.sh /tmp/setup.sh RUN /tmp/setup.sh diff --git a/heroku-22/setup.sh b/heroku-22/setup.sh index 01ef1cd0..c3b56ff6 100755 --- a/heroku-22/setup.sh +++ b/heroku-22/setup.sh @@ -10,9 +10,12 @@ export DEBIAN_FRONTEND=noninteractive # The default sources list minus backports, restricted and multiverse. cat >/etc/apt/sources.list < /etc/ImageMagick-6/policy.xml <<'IMAGEMAGICK_POLICY'