Skip to content

Commit 56c88e7

Browse files
LuBashQjohannesjo
authored andcommitted
build: create multi-arch Docker images
Create multi-arch Docker images. Currently built platforms are: * linux/amd64 * linux/arm64 * linux/arm/v7 Signed-off-by: LuBashQ <[email protected]>
1 parent fb03c4a commit 56c88e7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/publish-to-hub-docker.yml

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
with:
3535
images: johannesjo/super-productivity
3636

37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
3740
- name: Build and push Docker image
3841
uses: docker/build-push-action@v6
3942
with:
@@ -43,3 +46,6 @@ jobs:
4346
labels: ${{ steps.meta.outputs.labels }}
4447
build-args: |
4548
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
49+
platforms: linux/amd64, linux/arm64, linux/arm/v7
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max

Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### build ###
44

55
# base image
6-
FROM node:20 as build
6+
FROM --platform=$BUILDPLATFORM node:20 as build
77

88
# add app
99
COPY . /app
@@ -26,7 +26,10 @@ RUN npm run buildFrontend:prodWeb
2626
### serve ###
2727

2828
# base image
29-
FROM nginx:1-alpine
29+
# --platform=$TARGETPLATFORM is redundant and docker will raise a warning,
30+
# but it makes it clearer that the target platform might be different from the
31+
# build platform
32+
FROM --platform=$TARGETPLATFORM nginx:1-alpine
3033

3134
# environmental variables
3235
ENV PORT=80

0 commit comments

Comments
 (0)