2025-02-13 20:57:45 +13:00
|
|
|
#####################################
|
|
|
|
# Build the app to a static website #
|
|
|
|
#####################################
|
|
|
|
# Modifier --platform=$BUILDPLATFORM limits the platform to "BUILDPLATFORM" during buildx multi-platform builds
|
|
|
|
# This is because npm "chromedriver" package is not compatiable with all platforms
|
|
|
|
# For more info see: https://docs.docker.com/build/building/multi-platform/#cross-compilation
|
|
|
|
FROM --platform=$BUILDPLATFORM node:18-alpine AS builder
|
2024-02-06 10:26:33 +00:00
|
|
|
|
2025-02-13 20:57:45 +13:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY package.json .
|
|
|
|
COPY package-lock.json .
|
|
|
|
|
|
|
|
# Install dependencies
|
2025-03-10 17:28:20 +13:00
|
|
|
# --ignore-scripts prevents postinstall script (which runs grunt) as it depends on files other than package.json
|
2025-02-13 20:57:45 +13:00
|
|
|
RUN npm ci --ignore-scripts
|
|
|
|
|
2025-03-10 17:28:20 +13:00
|
|
|
# Copy files needed for postinstall and build
|
2024-02-06 10:26:33 +00:00
|
|
|
COPY . .
|
2025-02-13 20:57:45 +13:00
|
|
|
|
|
|
|
# npm postinstall runs grunt, which depends on files other than package.json
|
|
|
|
RUN npm run postinstall
|
2025-03-10 17:28:20 +13:00
|
|
|
|
|
|
|
# Build the app
|
2024-02-06 10:26:33 +00:00
|
|
|
RUN npm run build
|
|
|
|
|
2025-02-13 20:57:45 +13:00
|
|
|
#########################################
|
|
|
|
# Package static build files into nginx #
|
|
|
|
#########################################
|
2025-03-10 17:28:20 +13:00
|
|
|
# We are using Github Actions: redhat-actions/buildah-build@v2 which needs manual selection of arch in base image
|
|
|
|
# Remove TARGETARCH if docker buildx is supported in the CI release as --platform=$TARGETPLATFORM will be automatically set
|
|
|
|
ARG TARGETARCH
|
2025-03-10 18:00:49 +13:00
|
|
|
ARG TARGETPLATFORM
|
2025-03-10 17:28:20 +13:00
|
|
|
FROM ${TARGETARCH}/nginx:stable-alpine AS cyberchef
|
2024-01-30 12:24:45 +00:00
|
|
|
|
2025-02-13 20:57:45 +13:00
|
|
|
COPY --from=builder /app/build/prod /usr/share/nginx/html/
|