-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.playwright
66 lines (44 loc) · 1.5 KB
/
Dockerfile.playwright
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
FROM rust:alpine3.21 AS rustbuilder
WORKDIR /app
RUN apk upgrade --update-cache --available && \
apk add gcc cmake make g++
COPY . .
RUN cargo install --no-default-features --path .
FROM alpine:3.21
# Installs latest Chromium package.
RUN apk upgrade --no-cache --available \
&& apk add --no-cache \
chromium-swiftshader \
ttf-freefont \
font-noto-emoji \
&& apk add --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
font-wqy-zenhei
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
EXPOSE 9222 6000
USER root
RUN apk add --no-cache tini curl sudo nodejs npm yarn \
&& npm install -g playwright \
&& npx playwright install chromium
# FROM zenika/alpine-chrome
# EXPOSE 9222 6000
# USER root
# RUN apk add --no-cache tini curl sudo nodejs npm yarn \
# && npm install -g playwright \
# && npx playwright install chromium
COPY --from=rustbuilder /usr/local/cargo/bin/chrome_server /usr/local/bin/chrome_server
RUN PLAYWRIGHT_CHROMIUM_PATH=$(find /root/.cache/ms-playwright | grep "chrome-linux/chrome$") && \
cp $PLAYWRIGHT_CHROMIUM_PATH /chromium_path
COPY ./docker-entrypoint.sh /
RUN apk add --no-cache tini curl sudo
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
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]