Optimized Dockerfiles for Node.js, Python, Go, and Rust. Minimal images, proper caching, non-root users.
Uploaded markdown content, not a verification of tool compatibility or results. Review the raw text, commands, and permissions before using it. Stars require an account.
name: docker-multistage
Prerequisites: set output: 'standalone' in next.config.js. Serve public and .next/static from a CDN, or copy them into the runtime image's public and .next/static directories; standalone output does not include them automatically.
FROM node:22-alpine AS builder
WORKDIR /app
COPY . .
RUN npm ci && npm run build
FROM node:22-alpine
COPY --from=builder /app/.next/standalone ./
USER 1001
CMD ["node", "server.js"]
All use non-root users and multi-stage for minimal attack surface.