-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (24 loc) · 802 Bytes
/
Copy pathDockerfile
File metadata and controls
37 lines (24 loc) · 802 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
34
35
36
37
# Stage 1: Build
FROM node:22-alpine AS builder
WORKDIR /usr/src/app
COPY package*.json ./
COPY prisma ./prisma/
RUN npm ci
COPY . .
RUN DATABASE_URL=file:./dev.db npx prisma generate
RUN npm run build
# Remove development node_modules and install only production dependencies
RUN npm prune --production
# Stage 2: Runtime
FROM node:22-alpine AS runner
WORKDIR /usr/src/app
ENV NODE_ENV=production
# Copy built application and required production packages
COPY --from=builder /usr/src/app/package*.json ./
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/prisma ./prisma
# Create placeholder folder for uploads/static assets if needed
RUN mkdir -p files
EXPOSE 3000
CMD ["node", "dist/src/main.js"]