-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 735 Bytes
/
Dockerfile
File metadata and controls
33 lines (23 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Stage 1: Build
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install --ignore-scripts
COPY . .
RUN npm run prisma:generate
RUN npm run build # e.g., tsc to compile TS to JS
# Stage 2: Production image
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production --ignore-scripts
# Install tsx for seeding in production
RUN npm install -g tsx
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/dist ./
COPY --from=builder /app/generated/prisma ./generated/prisma
COPY --from=builder /app/public ./public
COPY --from=builder /app/src/swagger-extra.yaml ./src/swagger-extra.yaml
# COPY --from=builder /app/.env ./.env
EXPOSE 3000
CMD ["node", "src/index.js"]