FreeTool
Developer Tools

Dockerfile Generator

Generate production-ready Dockerfiles for Node.js, Python, Go, Java, Rust, and more with multi-stage builds and best practices

Language / Framework

node

Node.js

Configuration

Options

Multi-stage build

Reduces final image size

Non-root user

Security best practice

Healthcheck

Polls /health on port 3000

DockerfileNode.js · 20 lines
1# ─── Build stage ───────────────────────────────────────────
2FROM node:20-alpine AS builder
3WORKDIR /app
4COPY package*.json ./
5RUN npm ci
6COPY . .
7RUN npm run build
8
9# ─── Production stage ───────────────────────────────────────
10FROM node:20-alpine
11WORKDIR /app
12RUN addgroup -S app && adduser -S app -G app
13COPY --from=builder /app/dist ./dist
14COPY --from=builder /app/package*.json ./
15RUN npm ci --omit=dev && npm cache clean --force
16ENV NODE_ENV=production
17EXPOSE 3000
18USER app
19CMD ["node", "dist/index.js"]
20
UTF-8LFNode.js
multi-stagenon-root20 lines

Don't see what you need?

We build free tools based on community feedback. If there's a utility that would improve your workflow, suggest it today!

Dockerfile Generator — Free Online Tool | FreeTool24