-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile.lightpanda
117 lines (85 loc) · 3.06 KB
/
Dockerfile.lightpanda
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
FROM ubuntu:22.04 AS pandabuilder
ARG ZIG=0.13.0
ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
ARG OS=linux
ARG ARCH=x86_64
ARG V8=11.1.134
ARG ZIG_V8=v0.1.11
RUN apt-get update -yq && \
apt-get install -yq xz-utils \
python3 ca-certificates git \
pkg-config libglib2.0-dev \
gperf libexpat1-dev \
cmake clang \
curl git
# install minisig
RUN curl -L -O https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz && \
tar xvzf minisign-0.11-linux.tar.gz
# install zig
RUN curl -O https://ziglang.org/download/${ZIG}/zig-linux-x86_64-${ZIG}.tar.xz && \
curl -O https://ziglang.org/download/${ZIG}/zig-linux-x86_64-${ZIG}.tar.xz.minisig
RUN minisign-linux/x86_64/minisign -Vm zig-linux-x86_64-${ZIG}.tar.xz -P ${ZIG_MINISIG}
# clean minisg
RUN rm -fr minisign-0.11-linux.tar.gz minisign-linux
# install zig
RUN tar xvf zig-linux-x86_64-${ZIG}.tar.xz && \
mv zig-linux-x86_64-${ZIG} /usr/local/lib && \
ln -s /usr/local/lib/zig-linux-x86_64-${ZIG}/zig /usr/local/bin/zig
# clean up zig install
RUN rm -fr zig-linux-x86_64-${ZIG}.tar.xz zig-linux-x86_64-${ZIG}.tar.xz.minisig
# force use of http instead of ssh with github
RUN cat <<EOF > /root/.gitconfig
[url "https://github.com/"]
insteadOf="git@github.com:"
EOF
# clone lightpanda
RUN git clone git@github.com:lightpanda-io/browser.git
WORKDIR /browser
# install deps
RUN git submodule init && \
git submodule update --recursive
RUN cd vendor/zig-js-runtime && \
git submodule init && \
git submodule update --recursive
RUN make install-libiconv && \
make install-netsurf && \
make install-mimalloc
# download and install v8
RUN curl -L -o libc_v8.a https://github.com/lightpanda-io/zig-v8-fork/releases/download/${ZIG_V8}/libc_v8_${V8}_${OS}_${ARCH}.a && \
mkdir -p vendor/zig-js-runtime/vendor/v8/${ARCH}-${OS}/release && \
mv libc_v8.a vendor/zig-js-runtime/vendor/v8/${ARCH}-${OS}/release/libc_v8.a
# build release
RUN make build
FROM ubuntu:22.04 AS rustbuilder
WORKDIR /app
# Get Ubuntu packages
RUN apt-get update && apt-get install -y \
build-essential \
cargo
COPY src/ ./src
COPY Cargo.* .
RUN cargo install --no-default-features --path .
FROM ubuntu:22.04
ARG VERSION=latest
COPY local.conf /etc/fonts/local.conf
RUN apt-get update && apt-get install -y \
build-essential \
tini curl sudo
# Add Chrome as a user
RUN mkdir -p /usr/src/app \
&& useradd -m chrome \
&& chown -R chrome:chrome /usr/src/app
EXPOSE 9222 6000 9223
# USER root
COPY --from=rustbuilder /root/.cargo/bin/chrome_server /usr/local/bin/chrome_server
COPY ./docker-entrypoint.sh /
COPY --from=pandabuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=pandabuilder /browser/zig-out/bin/lightpanda /bin/lightpanda
RUN chmod +x /docker-entrypoint.sh
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=/bin/lightpanda
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]