forked from Miracle656/Lens
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (33 loc) · 970 Bytes
/
Dockerfile
File metadata and controls
44 lines (33 loc) · 970 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
# Stage 1: Build
FROM node:20-alpine AS builder
WORKDIR /app
# Install dependencies
COPY package*.json ./
COPY prisma ./prisma/
RUN npm install
# Copy source and build
COPY . .
RUN npm run build
# Stage 2: Run
FROM node:20-alpine
WORKDIR /app
# Install curl for healthcheck
RUN apk add --no-cache curl
# Copy production dependencies
COPY package*.json ./
COPY prisma ./prisma/
RUN npm install --omit=dev
# Copy built assets
COPY --from=builder /app/dist ./dist
# Prisma engine and generated client are needed
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
# Need prisma for the auto-migration in src/index.ts
COPY --from=builder /app/node_modules/prisma ./node_modules/prisma
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3002
ENV HOST=0.0.0.0
EXPOSE 3002
# Startup script ensures DB is ready (handled in src/index.ts via execSync)
CMD ["npm", "start"]