-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
61 lines (48 loc) · 1.17 KB
/
Dockerfile
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
61
# Build stage
FROM node:20-slim AS builder
WORKDIR /app
COPY package*.json ./
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM node:20-slim
# Install only the essential Chromium dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
chromium \
fonts-liberation \
libatk-bridge2.0-0 \
libatk1.0-0 \
libatspi2.0-0 \
libcups2 \
libdbus-1-3 \
libdrm2 \
libgbm1 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
xdg-utils \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
WORKDIR /app
# Set environment variables for Puppeteer
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium \
NODE_ENV=production
# Copy only production dependencies
COPY package*.json ./
RUN npm ci --omit=dev && npm cache clean --force
# Copy built files from builder stage
COPY --from=builder /app/dist ./dist
# Copy fonts and templates
COPY fonts/ /usr/local/share/fonts/
COPY templates/ ./templates/
RUN fc-cache -f -v
# Start the application
CMD ["npm", "start"]