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
|
2026-06-19 07:19:17 +01:00
|
|
|
FROM --platform=$BUILDPLATFORM node:24-alpine@sha256:156b55f92e98ccd5ef49578a8cea0df4679826564bad1c9d4ef04462b9f0ded6 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 #
|
|
|
|
|
#########################################
|
2026-06-19 07:19:17 +01:00
|
|
|
FROM nginxinc/nginx-unprivileged:stable-alpine@sha256:fafa1102c789119971b3d83f9293f1ef5526bc73583a12e13ff5cd1299ed8b6c AS cyberchef
|
2024-01-30 12:24:45 +00:00
|
|
|
|
2026-02-18 08:05:10 +00:00
|
|
|
LABEL maintainer="GCHQ <oss@gchq.gov.uk>"
|
|
|
|
|
|
2025-02-13 20:57:45 +13:00
|
|
|
COPY --from=builder /app/build/prod /usr/share/nginx/html/
|