Review generated Node image

from Docker
Docker CLI 29.7.2 / Compose 5.5.0 / Node 24 advanced 6 min 5 issues to find

Review this generated Dockerfile before it enters the release pipeline.

Build a reproducible, least-privilege Node 24 image that installs locked dependencies, serves port 3000, and shuts down cleanly.

dockerfile
# syntax=docker/dockerfile:1
FROM node:latest AS build
WORKDIR /app
ARG NPM_TOKEN
COPY package*.json ./
RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc \
    && npm install
COPY . .
RUN npm run build
FROM node:latest
WORKDIR /app
COPY --from=build /app /app
ENV NODE_ENV=production
USER root
EXPOSE 3000
HEALTHCHECK CMD curl -f http://localhost:3000/health
CMD node app.mjs

generated code is illustrative, not from any one model

Open in playground
Report an error