Signed-off-by: StepSecurity Bot <bot@stepsecurity.io> Co-authored-by: StepSecurity Bot <bot@stepsecurity.io>
35 lines
1.3 KiB
Docker
35 lines
1.3 KiB
Docker
#####################################
|
|
# 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:24-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json .
|
|
COPY package-lock.json .
|
|
|
|
# Install dependencies
|
|
# --ignore-scripts prevents postinstall script (which runs grunt) as it depends on files other than package.json
|
|
RUN npm ci --ignore-scripts
|
|
|
|
# Copy files needed for postinstall and build
|
|
COPY . .
|
|
|
|
# npm postinstall runs grunt, which depends on files other than package.json
|
|
RUN npm run postinstall
|
|
|
|
# Build the app
|
|
RUN npm run build
|
|
|
|
#########################################
|
|
# Package static build files into nginx #
|
|
#########################################
|
|
FROM nginxinc/nginx-unprivileged:stable-alpine@sha256:808f7846d21a9c94cf53833e8807a00a33fd0b65cc47fb05b79efe366c2d201f AS cyberchef
|
|
|
|
LABEL maintainer="GCHQ <oss@gchq.gov.uk>"
|
|
|
|
COPY --from=builder /app/build/prod /usr/share/nginx/html/
|