-
Notifications
You must be signed in to change notification settings - Fork 828
Expand file tree
/
Copy pathDockerfile
More file actions
87 lines (75 loc) · 2.85 KB
/
Copy pathDockerfile
File metadata and controls
87 lines (75 loc) · 2.85 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
FROM node:22-slim AS camofox-browser
# Pinned Camoufox version for reproducible builds
# Update these when upgrading Camoufox
ARG CAMOUFOX_VERSION=135.0.1
ARG CAMOUFOX_RELEASE=beta.24
ARG ARCH=x86_64
# Install dependencies for Camoufox (Firefox-based)
RUN apt-get update && apt-get install -y \
# Firefox dependencies
libgtk-3-0 \
libdbus-glib-1-2 \
libxt6 \
libasound2 \
libx11-xcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
# Mesa OpenGL/EGL for WebGL support (software rendering via llvmpipe)
# Without these, Firefox cannot create WebGL contexts -- a major bot detection signal
libegl1-mesa \
libgl1-mesa-dri \
libgbm1 \
# Xvfb virtual display -- runs Camoufox as if on a real desktop (better anti-detection)
xvfb \
# Fonts
fonts-liberation \
fonts-noto-color-emoji \
fontconfig \
# Utils
ca-certificates \
curl \
unzip \
# yt-dlp runtime dependency
python3-minimal \
&& rm -rf /var/lib/apt/lists/*
# Pre-bake Camoufox browser binary into image (downloaded at build time)
# Note: unzip returns exit code 1 for warnings (Unicode filenames), so we use || true and verify
RUN mkdir -p /root/.cache/camoufox \
&& curl -L -o /tmp/camoufox.zip "https://github.com/daijro/camoufox/releases/download/v${CAMOUFOX_VERSION}-${CAMOUFOX_RELEASE}/camoufox-${CAMOUFOX_VERSION}-${CAMOUFOX_RELEASE}-lin.${ARCH}.zip" \
&& (unzip -q /tmp/camoufox.zip -d /root/.cache/camoufox || true) \
&& rm /tmp/camoufox.zip \
&& chmod -R 755 /root/.cache/camoufox \
&& echo "{\"version\":\"${CAMOUFOX_VERSION}\",\"release\":\"${CAMOUFOX_RELEASE}\"}" > /root/.cache/camoufox/version.json \
&& test -f /root/.cache/camoufox/camoufox-bin && echo "Camoufox installed successfully"
# Install yt-dlp for YouTube transcript extraction (no browser needed)
RUN curl -L -o /usr/local/bin/yt-dlp "https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp" \
&& chmod 755 /usr/local/bin/yt-dlp
WORKDIR /app
COPY package.json package-lock.json ./
COPY scripts/ ./scripts/
RUN npm ci --omit=dev
COPY server.js ./
COPY camofox.config.json ./
COPY lib/ ./lib/
COPY plugins/ ./plugins/
COPY scripts/ ./scripts/
# Install default plugin dependencies (apt packages + post-install hooks)
RUN sh scripts/install-plugin-deps.sh
ENV NODE_ENV=production
ENV CAMOFOX_PORT=9377
EXPOSE 9377
CMD ["sh", "-c", "node --max-old-space-size=${MAX_OLD_SPACE_SIZE:-128} server.js"]
# Optional: rebuild plugin deps after adding third-party plugins
# Usage: docker build --target with-plugins -t camofox-browser .
FROM camofox-browser AS with-plugins
COPY plugins/ ./plugins/
COPY camofox.config.json ./
COPY scripts/install-plugin-deps.sh /tmp/install-plugin-deps.sh
RUN /tmp/install-plugin-deps.sh && rm /tmp/install-plugin-deps.sh