forked from browserless/browserless
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
150 lines (129 loc) · 4.89 KB
/
Dockerfile
File metadata and controls
150 lines (129 loc) · 4.89 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# ---------------------------------------------------------------------------
# browserless-chromium — Dockerfile for Talos k8s (Shipwright buildkit)
#
# The upstream browserless project ships per-browser Dockerfiles under
# docker/{base,chromium,firefox,webkit,edge,multi,sdk,chrome}/ where each
# per-browser file FROMs a shared browserless-base image. That pattern
# assumes the base is available locally on the build daemon (old Flatcar
# flow: `browserless-base:local`) or on a public registry.
#
# Neither works on the Talos cluster. Builds run via Shipwright in buildkit
# Pods that have no access to Flatcar's daemon-local images, and FROM'ing
# the in-cluster Zot (192.168.4.161:5000) would require daemon-level
# insecure-registry config that Shipwright's stock buildkit ClusterBuildStrategy
# doesn't expose (--tls-verify=false on push only, nothing for pull).
#
# This root-level Dockerfile inlines base + chromium into one file so every
# FROM resolves via public registries only. Layer caching through the
# in-cluster registry (--export-cache=type=inline --import-cache=type=registry)
# keeps warm rebuilds fast. Any change under packages/browserless/**
# invalidates buildSourceSha and triggers a rebuild (see
# infra/lib/build-identity.ts).
# ---------------------------------------------------------------------------
FROM ubuntu:24.04
LABEL org.opencontainers.image.source=https://github.com/DivMode/catchseo
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=America/Los_Angeles
ARG BLESS_USER_ID=999
ARG APP_DIR=/usr/src/app
ARG NODE_VERSION=v24.13.0
ARG NPM_VERSION=11.8.0
ENV NODE_VERSION=$NODE_VERSION
ENV NVM_DIR=/usr/src/.nvm
ENV NODE_PATH=$NVM_DIR/versions/node/$NODE_VERSION/bin
ENV PATH=$NODE_PATH:$PATH
ENV APP_DIR=$APP_DIR
ENV TZ=$TZ
ENV DEBIAN_FRONTEND=$DEBIAN_FRONTEND
ENV HOST=0.0.0.0
ENV PORT=3000
ENV LANG="C.UTF-8"
ENV NODE_ENV=production
ENV DEBUG_COLORS=true
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PLAYWRIGHT_BROWSERS_PATH=/usr/local/bin/playwright-browsers
ENV DBUS_SESSION_BUS_ADDRESS=autolaunch:
RUN mkdir -p $APP_DIR $NVM_DIR && \
groupadd -r blessuser && useradd --uid ${BLESS_USER_ID} -r -g blessuser -G audio,video blessuser && \
mkdir -p /home/blessuser/Downloads && \
chown -R blessuser:blessuser /home/blessuser
WORKDIR $APP_DIR
COPY fonts/* /usr/share/fonts/truetype/
RUN apt-get update \
&& apt-get install -y --no-install-recommends software-properties-common \
&& add-apt-repository universe \
&& echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections \
&& add-apt-repository multiverse \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
dumb-init \
git \
gnupg \
libu2f-udev \
ssh \
unzip \
wget \
xvfb \
xdotool \
dbus \
dbus-x11 \
libwebp-dev \
python3 python3-pip python3-setuptools \
fontconfig \
fonts-freefont-ttf \
fonts-gfs-neohellenic \
fonts-indic \
fonts-ipafont-gothic \
fonts-kacst \
fonts-liberation \
fonts-noto-cjk \
fonts-noto-color-emoji \
fonts-roboto \
fonts-thai-tlwg \
fonts-ubuntu \
fonts-wqy-zenhei \
fonts-open-sans \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
&& fc-cache -f -v \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/fonts/truetype/noto
RUN curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash &&\
. $NVM_DIR/nvm.sh &&\
nvm install $NODE_VERSION &&\
npm install -g npm@$NPM_VERSION
# FFmpeg static binaries via multi-stage copy (pinned, no external wget)
COPY --from=mwader/static-ffmpeg:8.0.1 /ffmpeg /usr/bin/ffmpeg
COPY --from=mwader/static-ffmpeg:8.0.1 /ffprobe /usr/bin/ffprobe
# Bun for build scripts (NOT runtime — see BUN_WEBSOCKET_BUG.md)
RUN curl -fsSL https://bun.com/install | bash && \
cp /root/.bun/bin/bun /usr/local/bin/bun && \
chmod +x /usr/local/bin/bun && \
rm -rf /root/.bun
COPY package.json package-lock.json ./
RUN npm clean-install --ignore-scripts
COPY assets assets
COPY bin bin
COPY extensions extensions
COPY external external
COPY scripts scripts
COPY static static
COPY CHANGELOG.md LICENSE NOTICE.txt README.md tsconfig.json ./
# ---------------------------------------------------------------------------
# chromium layer
# ---------------------------------------------------------------------------
COPY src src/
# NOTE: avoid `npx playwright-core` here — it would pull a newer version than
# the pinned one in package.json. Use the installed CLI directly.
RUN ./node_modules/playwright-core/cli.js install --with-deps chromium && \
npm run build && \
npm run build:function && \
npm prune production && \
npm run install:debugger && \
chown -R blessuser:blessuser $APP_DIR && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY pages pages
USER blessuser
CMD ["./scripts/start.sh"]