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

Support ARM64 when using Heroku-24 Docker images #1587

Closed
edmorley opened this issue May 29, 2024 · 1 comment · Fixed by #1575
Closed

Support ARM64 when using Heroku-24 Docker images #1587

edmorley opened this issue May 29, 2024 · 1 comment · Fixed by #1575
Assignees

Comments

@edmorley
Copy link
Member

edmorley commented May 29, 2024

Heroku itself currently runs on AMD64 CPUs, however, some users use our buildpacks locally on machines with ARM64 CPUs (such as M1/M2/M3 MacBooks) with the Heroku base images published to Docker Hub.

As such there have been requests to support the ARM64 architecture, e.g.:
heroku/base-images#194

Starting with Heroku-24, the base images published to Docker Hub are now multi-architecture (AMD64 + ARM64), and our preview Cloud Native Buildpacks support ARM64 when using Heroku-24.

However, until CNBs leave preview there will still be users using our classic buildpacks with our base images from Docker Hub, so it would be ideal if we could add ARM64 support to our classic buildpacks too. This will not only make the images faster to run locally, but also avoid breaking local development workflows if users update to Heroku-24 and miss the mention in the stack upgrade notes about using --platform linux/amd64 to force the architecture back to AMD64.

For example, the buildpack should support:

  1. git clone https://github.com/heroku/python-getting-started && cd python-getting-started
  2. Add a Dockerfile with the below contents.
  3. docker build --tag arm-test --platform linux/arm64 .
  4. docker run --rm -e PORT=5001 -p 5001:5001 arm-test
  5. curl localhost:5001
FROM heroku/heroku:24-build as build
ENV STACK=heroku-24
COPY --chown=heroku . /app
WORKDIR /app
# This is after the COPY line so buildpack updates are picked up.
RUN mkdir -p /tmp/buildpack /tmp/cache /tmp/env \
  && curl https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz \
    | tar -xz -C /tmp/buildpack
RUN /tmp/buildpack/bin/compile /app /tmp/cache /tmp/env

FROM heroku/heroku:24
COPY --from=build --chown=heroku /app /app
ENV HOME=/app
WORKDIR /app
CMD ["bash", "-c", "for f in .profile.d/*; do source \"${f}\"; done && gunicorn gettingstarted.wsgi"]
@edmorley edmorley self-assigned this May 29, 2024
@edmorley
Copy link
Member Author

Support for this was added as part of #1575.

For example:

python-getting-started $ docker build --tag arm-test --platform linux/arm64 .
python-getting-started $ docker run --rm -e PORT=5001 -p 5001:5001 arm-test
[2024-05-29 13:07:07 +0000] [1] [INFO] Starting gunicorn 22.0.0
[2024-05-29 13:07:07 +0000] [1] [INFO] Listening at: http://0.0.0.0:5001 (1)
[2024-05-29 13:07:07 +0000] [1] [INFO] Using worker: sync
[2024-05-29 13:07:07 +0000] [8] [INFO] Booting worker with pid: 8
[2024-05-29 13:07:10 +0000] [1] [INFO] Handling signal: winch
192.168.65.1 - - [29/May/2024:13:07:15 +0000] "GET / HTTP/1.1" 200 7437 "-" "curl/8.6.0"

@edmorley edmorley linked a pull request May 29, 2024 that will close this issue
@edmorley edmorley changed the title Support running buildpack natively on ARM64 with Heroku-24 Docker images Support ARM64 with Heroku-24 Docker images May 29, 2024
@edmorley edmorley changed the title Support ARM64 with Heroku-24 Docker images Support ARM64 when using Heroku-24 Docker images May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant