Skip to content

Commit 044cc8a

Browse files
Add arm support (#426)
* Add arm support * Add arm support for dev build * Remove load flag incompatible with multiarch builds
1 parent 9852f0d commit 044cc8a

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ jobs:
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
17-
# Docker
18-
- name: Docker production
19-
run: docker build .
17+
# Set up Docker Buildx for multi-arch support
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
# Build multi-arch image
21+
- name: Build Docker image (multi-arch)
22+
run: |
23+
docker buildx create --use
24+
docker buildx build --platform linux/amd64,linux/arm64 .
2025
# Docker development
2126
- name: Docker development
22-
run: docker build -f Dockerfile.brain.dev .
27+
run: docker buildx build -f Dockerfile.brain.dev --platform linux/amd64,linux/arm64 .
2328
build:
2429
runs-on: ubuntu-latest
2530
steps:

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ jobs:
2121
username: ${{ github.repository_owner }}
2222
password: ${{ secrets.GITHUB_TOKEN }}
2323

24+
# Set up Docker Buildx for multi-arch support
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
# Build and push multi-arch Docker image
2429
- name: Build and push Staking brain docker monorepo
2530
uses: docker/build-push-action@v3
2631
with:
2732
file: Dockerfile
2833
push: true
34+
platforms: linux/amd64, linux/arm64
2935
tags: ghcr.io/${{ github.repository_owner }}/staking-brain:${{ github.event.inputs.tag }}
3036

3137
gh-release:

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG DOCKER_IMAGE=node:20.17.0-alpine3.20
22

33
# Build
4-
FROM ${DOCKER_IMAGE} AS build-stage
4+
FROM --platform=$TARGETPLATFORM ${DOCKER_IMAGE} AS build-stage
55

66
WORKDIR /app
77
COPY package.json yarn.lock tsconfig.json .yarnrc.yml ./
@@ -19,7 +19,7 @@ RUN yarn install --immutable && \
1919
yarn workspaces focus --all --production
2020

2121
# Production
22-
FROM ${DOCKER_IMAGE}
22+
FROM --platform=$TARGETPLATFORM ${DOCKER_IMAGE}
2323
ENV NODE_ENV=production
2424
WORKDIR /app
2525
COPY ./packages/brain/tls ./tls

Dockerfile.brain.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG DOCKER_IMAGE=node:20.17.0-alpine3.20
2-
FROM ${DOCKER_IMAGE} as build-stage
2+
FROM --platform=$TARGETPLATFORM ${DOCKER_IMAGE} as build-stage
33

44
ENV NODE_ENV=development
55
WORKDIR /app

0 commit comments

Comments
 (0)