Files
Ali JaaferandGitHub 14a130cede examples: Update NODE_VERSION to 24.13.1 in Dockerfile (#11591)
Description
A flaw in Node.js's buffer allocation logic can expose uninitialized
memory when allocations are interrupted, when using the `vm` module with
the timeout option. Under specific timing conditions, buffers allocated
with `Buffer.alloc` and other `TypedArray` instances like `Uint8Array`
may contain leftover data from previous operations, allowing in-process
secrets like tokens or passwords to leak or causing data corruption.
While exploitation typically requires precise timing or in-process code
execution, it can become remotely exploitable when untrusted input
influences workload and timeouts, leading to potential confidentiality
and integrity impact.
2026-01-30 20:22:59 -07:00

45 lines
1.2 KiB
Docker

ARG NODE_VERSION=24.13.1
FROM node:${NODE_VERSION}-slim AS base
# The web Dockerfile is copy-pasted into our main docs at /docs/handbook/deploying-with-docker.
# Make sure you update this Dockerfile, the Dockerfile in the web workspace and copy that over to Dockerfile in the docs.
FROM base AS prepare
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune api --docker
# Add lockfile and package.json's of isolated subworkspace
FROM base AS builder
WORKDIR /app
# First install dependencies (as they change less often)
COPY --from=prepare /app/out/json/ .
RUN yarn install
# Build the project and its dependencies
COPY --from=prepare /app/out/full/ .
# Uncomment and use build args to enable remote caching
# ARG TURBO_TEAM
# ENV TURBO_TEAM=$TURBO_TEAM
# ARG TURBO_TOKEN
# ENV TURBO_TOKEN=$TURBO_TOKEN
RUN yarn turbo build
FROM node:${NODE_VERSION}-alpine AS runner
WORKDIR /app
# Don't run production as root
RUN addgroup --system --gid 1001 expressjs
RUN adduser --system --uid 1001 expressjs
USER expressjs
COPY --from=builder /app .
CMD node apps/api/dist/index.js