Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
Added ARM64 support with multiarch build
Browse files Browse the repository at this point in the history
  • Loading branch information
boboldehampsink committed Sep 6, 2022
1 parent 5af42be commit 2744978
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
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}" "${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" "$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" "$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" "$CNB_BUILD_DOCKERFILE_DIR" | indent

display "Size breakdown..."
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" \
Expand Down
11 changes: 7 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 @@ -195,7 +198,7 @@ apt-get install -y --no-install-recommends \
shared-mime-info \
socat \
stunnel \
syslinux \
syslinux-common \
tar \
telnet \
tzdata \
Expand Down
11 changes: 7 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 @@ -197,7 +200,7 @@ apt-get install -y --no-install-recommends \
shared-mime-info \
socat \
stunnel \
syslinux \
syslinux-common \
tar \
telnet \
tzdata \
Expand Down
11 changes: 7 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 @@ -197,7 +200,7 @@ apt-get install -y --no-install-recommends \
shared-mime-info \
socat \
stunnel \
syslinux \
syslinux-common \
tar \
telnet \
tzdata \
Expand Down

0 comments on commit 2744978

Please sign in to comment.