answersLogoWhite

0

# Build stage

FROM node:20-alpine AS builder

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build

# Production stage

FROM node:20-alpine

WORKDIR /app

COPY package*.json ./

RUN npm ci --only=production

COPY --from=builder /app/dist ./dist

EXPOSE 3000

CMD ["node", "dist/index.js"]

This Dockerfile:

Uses Node.js 20.

Sets the working directory.

Installs dependencies.

Copies application files.

Exposes port 3000.

Starts the app with npm start

User Avatar

Himanshi kaur

Lvl 8
3w ago

What else can I help you with?