-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (44 loc) · 1.27 KB
/
Dockerfile
File metadata and controls
60 lines (44 loc) · 1.27 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
# --- Stage 1: Build the app ---
FROM node:22-alpine AS builder
WORKDIR /app
# Copy only package files first (for caching)
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy the rest of the project
COPY . .
# Generate Prisma Client (so Nest build finds Role/User types)
RUN npx prisma generate
# Build the NestJS app
RUN npm run build
# --- Stage 2: Run the app ---
FROM node:22-alpine AS runner
WORKDIR /app
# Install Chromium + libvips for sharp
RUN apk add --no-cache \
chromium \
chromium-chromedriver \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont \
vips-dev fftw-dev build-base libc6-compat
# Copy build output and Prisma schema (needed for runtime queries)
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/package*.json ./
# Copy the entrypoint script
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Install only production dependencies
RUN npm ci --omit=dev
# Environment
ENV NODE_ENV=production
# Tell Selenium / Puppeteer where Chromium is
ENV CHROME_PATH=/usr/bin/chromium-browser
ENV CHROMEDRIVER_PATH=/usr/bin/chromedriver
# Expose port
EXPOSE 3001
# Use entrypoint instead of CMD
ENTRYPOINT ["entrypoint.sh"]