-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile.headless_shell
54 lines (35 loc) · 1.22 KB
/
Dockerfile.headless_shell
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
FROM rust:alpine3.21 AS rustbuilder
WORKDIR /app
RUN apk upgrade --update-cache --available && \
apk add --no-cache gcc make g++ cmake musl-dev perl libressl-dev
COPY src/ ./src
COPY Cargo.* .
RUN cargo install --no-default-features --path .
FROM alpine:3.21
ARG VERSION=latest
COPY out/$VERSION/headless-shell/ /headless-shell/
COPY local.conf /etc/fonts/local.conf
# Add Chrome as a user
RUN mkdir -p /usr/src/app \
&& adduser -D chrome \
&& chown -R chrome:chrome /usr/src/app
# Run Chrome as non-privileged
USER chrome
WORKDIR /usr/src/app
ENV CHROME_BIN=/usr/bin/chromium-browser \
CHROME_PATH=/headless-shell:$PATH
EXPOSE 9222 6000 9223
USER root
COPY --from=rustbuilder /usr/local/cargo/bin/chrome_server /usr/local/bin/chrome_server
COPY ./docker-entrypoint.sh /
RUN apk add --no-cache tini curl sudo nss dbus freetype harfbuzz ca-certificates libxcomposite libxrandr \
libxdamage libxext libxshmfence mesa-gl udev gcompat
RUN chmod +x /docker-entrypoint.sh
USER chrome
ENV REMOTE_ADDRESS=0.0.0.0
ENV LAUNCH=init
ENV DEFAULT_PORT=9223
ENV DEFAULT_PORT_SERVER=6000
# ENV HOSTNAME_OVERRIDE=127.0.0.1
ENV DEFAULT_LAUNCH_NAME=/headless-shell/headless-shell
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]