Skip to content

Commit f3c400c

Browse files
author
Joachim Rosskopf
committed
Refactor Dockerfile and GitHub Actions for multi-architecture support
- Updated Dockerfile to copy the 'flapi' binary from the build stage. - Modified GitHub Actions workflow to implement a matrix strategy for building on both linux/amd64 and linux/arm64 platforms, enhancing multiarch support.
1 parent 4bb8e94 commit f3c400c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/workflows/build.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ jobs:
122122
runs-on: ubuntu-latest
123123
if: github.event_name == 'push'
124124

125+
strategy:
126+
matrix:
127+
platform: [linux/amd64, linux/arm64]
125128
steps:
126129
- uses: actions/checkout@v4
127130

@@ -149,14 +152,11 @@ jobs:
149152
with:
150153
context: .
151154
file: Dockerfile
152-
platforms: linux/amd64,linux/arm64
155+
platforms: ${{ matrix.platform }}
153156
push: true
154157
tags: |
155158
ghcr.io/${{ env.REPO_OWNER }}/flapi:latest
156159
ghcr.io/${{ env.REPO_OWNER }}/flapi:${{ github.sha }}
157160
provenance: false
158-
build-args: |
159-
TARGETARCH=${{ matrix.arch }}
160161
build-contexts: |
161-
linux/amd64=artifacts/flapi-linux-amd64
162-
linux/arm64=artifacts/flapi-linux-arm64
162+
build=./artifacts/flapi-linux-${{ endsWith(matrix.platform, 'amd64') && 'amd64' || 'arm64' }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
88
&& rm -rf /var/lib/apt/lists/*
99

1010
WORKDIR /app
11-
COPY flapi /app/flapi
11+
COPY --from=build flapi /app/flapi
1212
RUN chmod +x /app/flapi
1313

1414
ENTRYPOINT ["/app/flapi"]

0 commit comments

Comments
 (0)