-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.render
39 lines (35 loc) · 1.94 KB
/
Dockerfile.render
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
# syntax=docker/dockerfile:1.6.0
FROM debian:bookworm-20240408-slim AS mupdf
WORKDIR /app
RUN apt-get update && apt-get install -y build-essential
ADD https://mupdf.com/downloads/archive/mupdf-1.24.1-source.tar.gz mupdf.tar.gz
RUN mkdir mupdf && tar xf mupdf.tar.gz --strip-components 1 -C mupdf && \
cd mupdf && make HAVE_X11=no HAVE_GLUT=no -j$(nproc)
FROM debian:bookworm-20240408-slim AS latex
WORKDIR /app
RUN apt-get update && apt-get install -y perl curl
ADD https://mirrors.rit.edu/CTAN/systems/texlive/tlnet/install-tl-unx.tar.gz install-tl.tar.gz
RUN tar xf install-tl.tar.gz
COPY render/texlive.profile .
RUN ./install-tl-*/install-tl --profile texlive.profile --repository https://mirrors.rit.edu/CTAN/systems/texlive/tlnet
RUN ./texlive/texdir/bin/*-linux/tlmgr install \
cancel chemfig chemformula circuitikz cjhebrew collection-fontsrecommended \
doublestroke esint esint-type1 mhchem pgf-blur pgfplots physics rsfs \
simplekv siunitx standalone tikz-cd tikzducks tikzlings units varwidth xstring
COPY render/texmf.cnf texlive/texdir
COPY render/preamble.tex .
RUN ./texlive/texdir/bin/*-linux/pdflatex -ini -output-format pdf '&latex preamble.tex'
FROM rust:1.77.2-slim-bookworm AS render
WORKDIR /app
COPY Cargo.lock Cargo.toml ./
COPY src src
RUN --mount=type=cache,sharing=private,target=/usr/local/cargo/registry --mount=type=cache,target=/app/target \
cargo build --locked --release --bin render && mkdir bin && cp target/release/render bin
FROM pwn.red/jail:0.4.1
COPY --link --from=busybox:1.36.1-glibc / /srv
COPY --link --from=mupdf /app/mupdf/build/release/mutool /srv/app/
COPY --link --from=latex /usr/lib/*-linux-gnu/libstdc++.so.6 /lib/*-linux-gnu/libgcc_s.so.1 /lib/*-linux-gnu/libdl.so.2 /srv/lib/
COPY --link --from=latex /app/texlive /srv/app/texlive
COPY --link --from=latex /app/preamble.fmt /srv/app/
COPY --link --from=render /app/bin/render /srv/app/run
ENV JAIL_TIME=0 JAIL_PIDS=10 JAIL_MEM=100M JAIL_CPU=1000 JAIL_TMP_SIZE=20M