Dockerfile arm architecture #1892

Open
opened 2021-12-01 08:27:49 +01:00 by PeterSurda · 1 comment
PeterSurda commented 2021-12-01 08:27:49 +01:00 (Migrated from github.com)

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

The `buildscripts/docker/Dockerfile.bionic` doesn't work on arm architecture (Apple M1, Raspberry Pi, ...).
PeterSurda commented 2021-12-09 05:05:16 +01:00 (Migrated from github.com)

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
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 ```
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Bitmessage/PyBitmessage-2024-12-04#1892
No description provided.