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

Dockerfile arm architecture #1892

Open
PeterSurda opened this issue Dec 1, 2021 · 1 comment
Open

Dockerfile arm architecture #1892

PeterSurda opened this issue Dec 1, 2021 · 1 comment
Assignees
Labels
build Related to building or build system

Comments

@PeterSurda
Copy link
Member

The buildscripts/docker/Dockerfile.bionic doesn't work on arm architecture (Apple M1, Raspberry Pi, ...).

@PeterSurda PeterSurda added the build Related to building or build system label Dec 1, 2021
@PeterSurda
Copy link
Member Author

PeterSurda commented Dec 9, 2021

Update on how to deal with this:

  • it helps if you use BuildKit for building. You can enable it by export DOCKER_BUILDKIT=1 before running docker build
  • if BuildKit is enabled, add a new line with ARG TARGETARCH just after the top FROM
  • if BuildKit isn't enabled, you need to add the TARGETARCH argument into the command line when executing the command line manually
  • then the $TARGETARCH argument in the rest of the Dockerfile can be used to distinguish between amd64 and arm64. I haven't tested other platforms.
  • since Dockerfile syntax doesn't support branching, the way I found to do this is to have a per-architecture stage, for example
# default
ARG TARGETARCH=amd64

# Intel and AMD
FROM base AS deps-amd64
RUN apt install bla bla

# ARM
FROM base AS deps-arm64
RUN apt install bla bla

# next stage
FROM deps-$TARGETARCH AS travis
RUN blabla

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to building or build system
Projects
None yet
Development

No branches or pull requests

2 participants