Containers · In-browser

Dockerfile Generator

Choose your stack and options, and get a sensible multi-stage Dockerfile — heavy build stage, slim non-root runtime — that you can drop straight into a repo.

Stack

Every template is multi-stage: a heavy build stage, then a slim, non-root runtime. Adjust the start command and copied paths to match your project layout.

Dockerfile

# syntax=docker/dockerfile:1

# --- deps: install node_modules in a cacheable layer ---
FROM node:22-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci

# --- build: compile the app ---
FROM node:22-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build

# --- runtime: small, non-root image ---
FROM node:22-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app ./
EXPOSE 3000
USER node
CMD ["npm", "start"]

Going deeper than a quick tool?

These utilities are on us. When you're prepping for real interviews, our cloud & DevOps kits go from fundamentals to scenario questions — and our free resource library has cheatsheets and infographics to keep beside you.