Skip to content

Commit f8b613b

Browse files
committed
Docker multiplatform build support. Pending CI workflow test
1 parent e48fc4c commit f8b613b

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

.github/workflows/releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
tags: ${{ steps.image-metadata.outputs.tags }}
6262
labels: ${{ steps.image-metadata.outputs.labels }}
6363
containerfiles: ./Dockerfile
64-
platforms: linux/amd64
64+
platforms: linux/amd64,linux/arm64,linux/arm/v7
6565
oci: true
6666
# Webpack seems to use a lot of open files, increase the max open file limit to accomodate.
6767
extra-args: |

Dockerfile

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
1-
FROM node:18-alpine AS build
1+
#####################################
2+
# Build the app to a static website #
3+
#####################################
4+
# Modifier --platform=$BUILDPLATFORM limits the platform to "BUILDPLATFORM" during buildx multi-platform builds
5+
# This is because npm "chromedriver" package is not compatiable with all platforms
6+
# For more info see: https://docs.docker.com/build/building/multi-platform/#cross-compilation
7+
FROM --platform=$BUILDPLATFORM node:18-alpine AS builder
28

9+
WORKDIR /app
10+
11+
COPY package.json .
12+
COPY package-lock.json .
13+
14+
# Install dependencies
15+
# --ignore-scripts do not run grunt postinstall script as it depends on files other than package.json
16+
RUN npm ci --ignore-scripts
17+
18+
# Build the app
319
COPY . .
4-
RUN npm ci
20+
21+
# npm postinstall runs grunt, which depends on files other than package.json
22+
RUN npm run postinstall
523
RUN npm run build
624

7-
FROM nginx:1.25-alpine3.18 AS cyberchef
25+
#########################################
26+
# Package static build files into nginx #
27+
#########################################
28+
FROM nginx:stable-alpine AS cyberchef
829

9-
COPY --from=build ./build/prod /usr/share/nginx/html/
30+
COPY --from=builder /app/build/prod /usr/share/nginx/html/

0 commit comments

Comments
 (0)