Dockerfile Generator
Generate a production-ready Dockerfile with multi-stage builds, non-root user, and healthcheck best practices.
Node.js runtime with npm. Default port: 3000.
Base image variant
Base image: node:20-alpine
Dockerfile preview (495 bytes)
# syntax=docker/dockerfile:1
FROM node:20-alpine
WORKDIR /usr/src/app
# OCI image labels for traceability.
LABEL org.opencontainers.image.title="Node.js app"
LABEL org.opencontainers.image.source="https://github.com/example/repo"
LABEL org.opencontainers.image.licenses="MIT"
COPY package.json package-lock.json* ./
RUN npm ci
COPY . ./
# Create a non-root user for runtime least-privilege.
RUN addgroup -S nonroot && adduser -S nonroot -G nonroot
EXPOSE 3000
USER nonroot
CMD ["npm", "start"]