Anything older than Node v22 is end-of-life, and doesn't get any more support outside of commercial support. See https://endoflife.date/nodejs The current code is still compatible with Node v18.20 and up though, which switched from import assertions (`assert` keyword) to import attributes (`with` keyword). See https://nodejs.org/en/blog/release/v18.20.0 We can't go higher than v22 yet due to certain dependencies depending on obsolete behavior and `node` command line flags. For instance, the current version of `argon2-browser` (which is 4 years old) breaks on Node's native `fetch` behavior, which used to be experimental, but is now mainstream, and can no longer be disabled in Node v23 and up.
33 lines
1.1 KiB
Docker
33 lines
1.1 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:22-alpine 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 nginx:stable-alpine AS cyberchef
|
|
|
|
COPY --from=builder /app/build/prod /usr/share/nginx/html/
|