File tree Expand file tree Collapse file tree 1 file changed +14
-15
lines changed
Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change 1- FROM node:20-alpine
1+ FROM node:20-alpine AS builder
22
33WORKDIR /app
44
5- # Copying dependencies & env & schema
65COPY package*.json ./
76COPY prisma ./prisma
87
9- # Install dependencies
10- RUN npm install
8+ RUN npm ci
9+
10+ RUN DATABASE_URL="x" npx prisma generate
1111
12- # Copying source code
1312COPY . .
13+ RUN npm run build
14+
15+ # ---- Final image ----
16+ FROM node:20-alpine AS runner
1417
15- # Clean old builds -- (super important)
16- RUN rm -rf node_modules/.prisma dist
18+ WORKDIR /app
1719
18- # Generate Prisma Client
19- # Build-time ARG (only needed for prisma generate)
20- ARG DATABASE_URL
21- ENV DATABASE_URL=$DATABASE_URL
22- RUN npx prisma generate
20+ COPY --from=builder /app/dist ./dist
21+ COPY --from=builder /app/node_modules ./node_modules
22+ COPY --from=builder /app/prisma ./prisma
23+ COPY package*.json ./
2324
24- # Build TS files after client is ready
25- RUN npm run build
25+ ENV NODE_ENV=production
2626
27- # Run compiled app
2827CMD ["npm" , "start" ]
You can’t perform that action at this time.
0 commit comments