|
| 1 | +FROM ubuntu:22.04 |
| 2 | + |
| 3 | +ARG ZIG=0.13.0 |
| 4 | +ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U |
| 5 | +ARG OS=linux |
| 6 | +ARG ARCH=x86_64 |
| 7 | +ARG V8=11.1.134 |
| 8 | +ARG ZIG_V8=v0.1.9 |
| 9 | + |
| 10 | +RUN apt-get update -yq && \ |
| 11 | + apt-get install -yq xz-utils \ |
| 12 | + python3 ca-certificates git \ |
| 13 | + pkg-config libglib2.0-dev \ |
| 14 | + gperf libexpat1-dev \ |
| 15 | + cmake clang \ |
| 16 | + curl git |
| 17 | + |
| 18 | +# install minisig |
| 19 | +RUN curl -L -O https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz && \ |
| 20 | + tar xvzf minisign-0.11-linux.tar.gz |
| 21 | + |
| 22 | +# install zig |
| 23 | +RUN curl -O https://ziglang.org/download/${ZIG}/zig-linux-x86_64-${ZIG}.tar.xz && \ |
| 24 | + curl -O https://ziglang.org/download/${ZIG}/zig-linux-x86_64-${ZIG}.tar.xz.minisig |
| 25 | + |
| 26 | +RUN minisign-linux/x86_64/minisign -Vm zig-linux-x86_64-${ZIG}.tar.xz -P ${ZIG_MINISIG} |
| 27 | + |
| 28 | +# clean minisg |
| 29 | +RUN rm -fr minisign-0.11-linux.tar.gz minisign-linux |
| 30 | + |
| 31 | +# install zig |
| 32 | +RUN tar xvf zig-linux-x86_64-${ZIG}.tar.xz && \ |
| 33 | + mv zig-linux-x86_64-${ZIG} /usr/local/lib && \ |
| 34 | + ln -s /usr/local/lib/zig-linux-x86_64-${ZIG}/zig /usr/local/bin/zig |
| 35 | + |
| 36 | +# clean up zig install |
| 37 | +RUN rm -fr zig-linux-x86_64-${ZIG}.tar.xz zig-linux-x86_64-${ZIG}.tar.xz.minisig |
| 38 | + |
| 39 | +# force use of http instead of ssh with github |
| 40 | +RUN cat <<EOF > /root/.gitconfig |
| 41 | +[url "https://github.com/"] |
| 42 | + |
| 43 | +EOF |
| 44 | + |
| 45 | +# clone lightpanda |
| 46 | +RUN git clone [email protected]:lightpanda-io/browser.git |
| 47 | + |
| 48 | +WORKDIR browser |
| 49 | + |
| 50 | +# install deps |
| 51 | +RUN git submodule init && \ |
| 52 | + git submodule update --recursive |
| 53 | + |
| 54 | +RUN cd vendor/zig-js-runtime && \ |
| 55 | + git submodule init && \ |
| 56 | + git submodule update --recursive |
| 57 | + |
| 58 | +RUN make install-netsurf && \ |
| 59 | + make install-mimalloc |
| 60 | + |
| 61 | +# download and install v8 |
| 62 | +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 && \ |
| 63 | + mkdir -p vendor/zig-js-runtime/vendor/v8/${ARCH}-${OS}/release && \ |
| 64 | + mv libc_v8.a vendor/zig-js-runtime/vendor/v8/${ARCH}-${OS}/release/libc_v8.a |
| 65 | + |
| 66 | +# build release |
| 67 | +RUN make build |
| 68 | + |
| 69 | +FROM ubuntu:22.04 |
| 70 | + |
| 71 | +COPY --from=0 /browser/zig-out/bin/browsercore /bin/lightpanda |
| 72 | +COPY --from=0 /browser/zig-out/bin/browsercore-get /bin/lightpanda-get |
| 73 | + |
| 74 | +CMD ["/bin/lightpanda", "--host", "0.0.0.0", "--port", "3245"] |
0 commit comments