-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (32 loc) · 938 Bytes
/
Dockerfile
File metadata and controls
48 lines (32 loc) · 938 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
38
39
40
41
42
43
44
45
46
47
48
# Base stage
FROM node:22-alpine AS base
WORKDIR /app
# Copy the package.json and package-lock.json
COPY package*.json ./
RUN npm install
# Copy the Prisma schema and migrations first
COPY prisma ./prisma
RUN npx prisma generate
# Copy the application code
COPY . .
# Build stage
FROM base AS build
# Build the TypeScript application
RUN npm run build
# Production stage
FROM node:22-alpine AS production
WORKDIR /app
# Install only production dependencies to reduce image size
COPY package*.json ./
# Copy the Prisma schema and migrations first
COPY prisma ./prisma
RUN npx prisma generate
# Install production dependencies only
RUN npm ci --only=production
# Copy only the necessary files from the build stage
# COPY --from=base /app/package*.json ./
# COPY --from=base /app/node_modules ./node_modules
COPY --from=build /app/prisma ./prisma
COPY --from=build /app/dist ./dist
# Run the application
CMD ["npm", "start"]