-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (50 loc) · 1.54 KB
/
Copy pathDockerfile
File metadata and controls
59 lines (50 loc) · 1.54 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
FROM node:20-bookworm-slim
# Apply security patches for all base packages before anything else
RUN apt-get update && apt-get upgrade -y --no-install-recommends \
&& apt-get install -y --no-install-recommends \
gnupg \
fonts-liberation libasound2 libatk-bridge2.0-0 \
libcups2 libgbm1 libgtk-3-0 libnss3 \
xdg-utils --no-install-recommends \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
wget \
libdrm2 \
libdbus-1-3 \
libxkbcommon0 \
libatspi2.0-0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libpango-1.0-0 \
libcairo2 \
libasound2 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json* ./
RUN npm ci --production=false
# Store Patchright/Chromium inside /app so non-root user can access it
ENV PLAYWRIGHT_BROWSERS_PATH=/app/.browsers
RUN npx patchright install chromium
# Build TypeScript
COPY tsconfig.json ./
COPY src/ ./src/
RUN npm run build
# Prune devDependencies
RUN npm prune --production
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates libcurl4 libvulkan1 && \
wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
apt-get install -y ./google-chrome-stable_current_amd64.deb && \
rm google-chrome-stable_current_amd64.deb && \
rm -rf /var/lib/apt/lists/*
# Run as non-root (node user exists in node:slim images)
RUN chown -R node:node /app
USER node
CMD ["node", "dist/index.js"]