|
| 1 | +FROM debian:bookworm-slim |
| 2 | + |
| 3 | +RUN apt-get update \ |
| 4 | +&& apt-get install -y --no-install-recommends \ |
| 5 | + git \ |
| 6 | + wget \ |
| 7 | + npm \ |
| 8 | + python3 \ |
| 9 | + python3-pip \ |
| 10 | + python3-venv \ |
| 11 | + less \ |
| 12 | +&& apt-get autoremove -y \ |
| 13 | +&& apt-get clean \ |
| 14 | +&& rm -rf /var/lib/apt/lists/* \ |
| 15 | +&& rm -rf /tmp/* /var/tmp/* |
| 16 | + |
| 17 | +ENV VIRTUAL_ENV=/opt/venv |
| 18 | +RUN python3 -m venv $VIRTUAL_ENV |
| 19 | +ENV PATH="$VIRTUAL_ENV/bin:$PATH" |
| 20 | + |
| 21 | +RUN apt-get update \ |
| 22 | +&& apt-get install -y --no-install-recommends \ |
| 23 | + python3-dev \ |
| 24 | + python3-louis \ |
| 25 | + libcairo2-dev \ |
| 26 | + librsvg2-bin \ |
| 27 | + gcc \ |
| 28 | + build-essential \ |
| 29 | +&& pip install pip --upgrade --no-cache-dir \ |
| 30 | +&& pip install pretext[homepage,prefigure] codechat-server --prefer-binary --no-cache-dir \ |
| 31 | +&& prefig init \ |
| 32 | +&& playwright install-deps \ |
| 33 | +&& playwright install chromium \ |
| 34 | +&& echo '/usr/lib/python3/dist-packages' > /usr/local/lib/python3.11/dist-packages/louis.pth \ |
| 35 | +&& echo '/usr/lib/python3/dist-packages' > /opt/venv/lib/python3.11/site-packages/louis.pth \ |
| 36 | +&& prefig init \ |
| 37 | +&& npm install @mermaid-js/mermaid-cli -g \ |
| 38 | +&& apt-get remove -y \ |
| 39 | + python3-dev \ |
| 40 | + libcairo2-dev \ |
| 41 | + gcc \ |
| 42 | + build-essential \ |
| 43 | +&& apt-get autoremove -y \ |
| 44 | +&& apt-get clean \ |
| 45 | +&& rm -rf /var/lib/apt/lists/* \ |
| 46 | +&& rm -rf /tmp/* /var/tmp/* |
| 47 | + |
| 48 | +# If the platform is linux/arm64, we also need to install default-jre |
| 49 | +ARG TARGETPLATFORM |
| 50 | + |
| 51 | +RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ |
| 52 | + apt-get update && \ |
| 53 | + apt-get install -y --no-install-recommends default-jre && \ |
| 54 | + apt-get clean && \ |
| 55 | + rm -rf /var/lib/apt/lists/*; \ |
| 56 | +fi |
| 57 | + |
| 58 | +# make shell prompt pretty |
| 59 | +RUN echo 'export PS1="\[\e[1;32m\]\u@\h:\[\e[1;34m\]\w \[\e[0m\]\$ "' >> ~/.bashrc |
| 60 | + |
| 61 | +# Set TMPDIR to avoid permission issues on ARM architectures |
| 62 | +ENV TMPDIR=/ |
| 63 | + |
| 64 | +RUN wget -O TinyTex.sh "https://yihui.org/tinytex/install-bin-unix.sh" \ |
| 65 | +&& bash TinyTex.sh \ |
| 66 | +&& rm TinyTex.sh |
| 67 | + |
| 68 | +#TinyTeX installs links to the executable in /root/bin, so we need to add that to the PATH |
| 69 | +ENV PATH="/root/bin:$PATH" |
| 70 | + |
| 71 | +SHELL ["/bin/bash", "-i", "-c"] |
| 72 | + |
| 73 | +RUN tlmgr install adjustbox amscdx bold-extra braket bussproofs cancel carlisle cases chessfss circuitikz colortbl enumitem extpfeil fontawesome5 fontaxes gensymb hobby imakeidx jknapltx kastrup lambda-lists listings listingsutf8 makeindex marvosym mathalpha mathtools menukeys mhchem microtype musicography newpx newtx nicematrix pdfcol pdfpages pdflscape pgfplots phaistos physics polyglossia pstricks realscripts relsize siunitx skak skaknew smartdiagram snapshot stmaryrd tcolorbox tikz-cd tikzfill titlesec txfonts ulem upquote was xfrac xltxtra xpatch xstring \ |
| 74 | +&& tlmgr path add |
| 75 | + |
| 76 | +# Ensure fonts provided by TinyTeX are available, as suggested in the pretext guide |
| 77 | + |
| 78 | +RUN fontconfig_path="/etc/fonts/conf.d/09-texlive-fonts.conf" && \ |
| 79 | + fontconfig="<?xml version=\"1.0\"?>\n<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n<fontconfig>\n <dir>~/.TinyTeX/texmf-dist/fonts</dir>\n <dir>~/.TinyTeX/texmf-local/fonts</dir>\n</fontconfig>" && \ |
| 80 | + if [ ! -f "$fontconfig_path" ]; then \ |
| 81 | + echo "Creating fontconfig file at $fontconfig_path"; \ |
| 82 | + echo -e "$fontconfig" > "$fontconfig_path"; \ |
| 83 | + else \ |
| 84 | + echo "Fontconfig file already exists at $fontconfig_path"; \ |
| 85 | + fi && \ |
| 86 | + fc-cache -f -v |
| 87 | + |
0 commit comments