← All code files

Dockerfile

Multi-stage Node.js image — small final layer, production deps only.

# --- build ---
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# --- run ---
FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=build /app/dist ./dist
EXPOSE 3000
CMD ["node", "dist/index.js"]

About this tool

Multi-stage Node.js image — small final layer, production deps only.

Ready-to-use Dockerfile — view the content, copy it, or download it with the correct filename. Free and 100% in your browser.