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

Added ARM64 support with multiarch build #227

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
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
8 changes: 4 additions & 4 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ 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
Expand All @@ -29,7 +29,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
Expand All @@ -38,12 +38,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}}" \
Expand Down
11 changes: 2 additions & 9 deletions bin/publish-to-registries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
set -euo pipefail
set -x


bin/build.sh "${STACK_VERSION}"

# Disable tracing temporarily to prevent logging registry tokens.
(set +x; echo "${DOCKER_HUB_TOKEN}" | docker login -u "${DOCKER_HUB_USERNAME}" --password-stdin)
(set +x; curl -f -X POST "$ID_SERVICE_TOKEN_ENDPOINT" -d "{\"username\":\"$ID_SERVICE_USERNAME\",\"password\":\"$ID_SERVICE_PASSWORD\"}" -s --retry 3 | jq -r ".raw_id_token" | docker login "$INTERNAL_REGISTRY_HOST" -u "$INTERNAL_REGISTRY_USERNAME" --password-stdin)

bin/build.sh "${STACK_VERSION}"

push_group() {
local targetTagBase="$1"
local targetTagSuffix="$2"
Expand Down Expand Up @@ -38,10 +37,4 @@ if [[ -v CIRCLE_TAG ]]; then

# Push release tags to internal registry
push_group "${internalTag}" ".${CIRCLE_TAG}"

# Push latest/no-suffix tags to dockerhub (e.g. heroku/heroku:22)
push_group "${publicTag}" ""

# Push latest/no-suffix tags to internal registry
push_group "${internalTag}" ""
boboldehampsink marked this conversation as resolved.
Show resolved Hide resolved
fi
1 change: 1 addition & 0 deletions heroku-18/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM ubuntu:18.04
ARG TARGETARCH
COPY setup.sh /tmp/setup.sh
RUN /tmp/setup.sh
1 change: 1 addition & 0 deletions heroku-18/installed-packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ shared-mime-info
socat
stunnel4
syslinux
syslinux-common
sysvinit-utils
tar
telnet
Expand Down
14 changes: 10 additions & 4 deletions heroku-18/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ export DEBIAN_FRONTEND=noninteractive

# The default sources list minus backports, restricted and multiverse.
cat >/etc/apt/sources.list <<EOF
deb http://archive.ubuntu.com/ubuntu/ bionic main universe
deb http://archive.ubuntu.com/ubuntu/ bionic-security main universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-security main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates main universe
deb [arch=arm64] http://ports.ubuntu.com/ bionic main universe
deb [arch=arm64] http://ports.ubuntu.com/ bionic-security main universe
deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates main universe
EOF

apt-get update
Expand Down Expand Up @@ -183,6 +186,7 @@ apt-get install -y --no-install-recommends \
locales \
lsb-release \
make \
mtools \
netcat-openbsd \
openssh-client \
openssh-server \
Expand All @@ -195,7 +199,7 @@ apt-get install -y --no-install-recommends \
shared-mime-info \
socat \
stunnel \
syslinux \
syslinux-common \
tar \
telnet \
tzdata \
Expand All @@ -205,6 +209,8 @@ apt-get install -y --no-install-recommends \
zip \
zstd \

# Install syslinux for amd64 only
if [ "$TARGETARCH" == "amd64" ]; then apt-get install -y --no-install-recommends syslinux; fi

cat > /etc/ImageMagick-6/policy.xml <<'IMAGEMAGICK_POLICY'
<policymap>
Expand Down
1 change: 1 addition & 0 deletions heroku-20/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM ubuntu:20.04
ARG TARGETARCH
COPY setup.sh /tmp/setup.sh
RUN /tmp/setup.sh
14 changes: 10 additions & 4 deletions heroku-20/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ export DEBIAN_FRONTEND=noninteractive

# The default sources list minus backports, restricted and multiverse.
cat >/etc/apt/sources.list <<EOF
deb http://archive.ubuntu.com/ubuntu/ focal main universe
deb http://archive.ubuntu.com/ubuntu/ focal-security main universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal-security main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal-updates main universe
deb [arch=arm64] http://ports.ubuntu.com/ focal main universe
deb [arch=arm64] http://ports.ubuntu.com/ focal-security main universe
deb [arch=arm64] http://ports.ubuntu.com/ focal-updates main universe
EOF

apt-get update
Expand Down Expand Up @@ -184,6 +187,7 @@ apt-get install -y --no-install-recommends \
locales \
lsb-release \
make \
mtools \
netcat-openbsd \
openssh-client \
openssh-server \
Expand All @@ -197,7 +201,7 @@ apt-get install -y --no-install-recommends \
shared-mime-info \
socat \
stunnel \
syslinux \
syslinux-common \
tar \
telnet \
tzdata \
Expand All @@ -207,6 +211,8 @@ apt-get install -y --no-install-recommends \
zip \
zstd \

# Install syslinux for amd64 only
if [ "$TARGETARCH" == "amd64" ]; then apt-get install -y --no-install-recommends syslinux; fi

cat > /etc/ImageMagick-6/policy.xml <<'IMAGEMAGICK_POLICY'
<policymap>
Expand Down
2 changes: 1 addition & 1 deletion heroku-22-build/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ apt-get install -y --no-install-recommends \
libonig-dev \
libpam0g-dev \
libpopt-dev \
libpq-dev \
libpq-dev=14.5-1.pgdg22.04+1 \
librabbitmq-dev \
libreadline-dev \
librtmp-dev \
Expand Down
1 change: 1 addition & 0 deletions heroku-22/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM ubuntu:22.04
ARG TARGETARCH
COPY setup.sh /tmp/setup.sh
RUN /tmp/setup.sh
13 changes: 9 additions & 4 deletions heroku-22/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ export DEBIAN_FRONTEND=noninteractive

# The default sources list minus backports, restricted and multiverse.
cat >/etc/apt/sources.list <<EOF
deb http://archive.ubuntu.com/ubuntu/ jammy main universe
deb http://archive.ubuntu.com/ubuntu/ jammy-security main universe
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-security main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates main universe
deb [arch=arm64] http://ports.ubuntu.com/ jammy main universe
deb [arch=arm64] http://ports.ubuntu.com/ jammy-security main universe
deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates main universe
EOF

apt-get update
Expand Down Expand Up @@ -185,6 +188,7 @@ apt-get install -y --no-install-recommends \
locales \
lsb-release \
make \
mtools \
netcat-openbsd \
openssh-client \
openssh-server \
Expand All @@ -197,7 +201,6 @@ apt-get install -y --no-install-recommends \
shared-mime-info \
socat \
stunnel \
syslinux \
tar \
telnet \
tzdata \
Expand All @@ -207,6 +210,8 @@ apt-get install -y --no-install-recommends \
zip \
zstd \

# Install syslinux for amd64 only
if [ "$TARGETARCH" == "amd64" ]; then apt-get install -y --no-install-recommends syslinux; fi

cat > /etc/ImageMagick-6/policy.xml <<'IMAGEMAGICK_POLICY'
<policymap>
Expand Down