Skip to content

Commit 603d313

Browse files
committed
chore(backend): add Dockerfile for containerizing Node.js backend
1 parent ec53eb4 commit 603d313

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎backend/Dockerfile‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:20-alpine AS builder
2+
WORKDIR /app
3+
COPY package*.json ./
4+
RUN npm ci
5+
COPY tsconfig.json ./
6+
COPY src ./src
7+
COPY migrations ./migrations
8+
RUN npm run build
9+
10+
FROM node:20-alpine AS runner
11+
WORKDIR /app
12+
ENV NODE_ENV=production
13+
COPY package*.json ./
14+
RUN npm ci --only=production
15+
COPY --from=builder /app/dist ./dist
16+
COPY --from=builder /app/migrations ./migrations
17+
EXPOSE 3001
18+
CMD ["node", "dist/index.js"]

0 commit comments

Comments
 (0)