Skip to content

Commit 67e4106

Browse files
committed
switch to versioned containers for base and full
1 parent afb4dfd commit 67e4106

File tree

4 files changed

+104
-47
lines changed

4 files changed

+104
-47
lines changed

.github/workflows/docker-publish.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: docker-publish
33
on:
44
schedule:
55
# * is a special character in YAML so you have to quote this string
6-
- cron: "0 0 * * 0"
6+
#- cron: "0 0 * * 0"
77

88
repository_dispatch:
99
types: [pretext-publish]
@@ -17,8 +17,7 @@ on:
1717
default: "all"
1818
options:
1919
- "all"
20-
- "lite"
21-
- "small"
20+
- "base"
2221
- "full"
2322

2423
jobs:
@@ -36,32 +35,29 @@ jobs:
3635
- name: Set up Docker Buildx
3736
uses: docker/setup-buildx-action@v3
3837

39-
- name: Build and push lite
40-
if: ${{ github.event.inputs.container == 'all' || github.event.inputs.container == 'lite' || github.event.inputs.container == '' }}
41-
uses: docker/build-push-action@v6
42-
with:
43-
platforms: linux/amd64,linux/arm64
44-
context: .
45-
file: ./lite/Dockerfile
46-
push: true
47-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pretext:lite
38+
- name: Get latest pretext version from PyPI
39+
run: |
40+
PTX_VERSION=$(curl -s https://pypi.org/pypi/pretext/json | grep -oP '"version":\s*"\K[^"]+')
41+
echo "Latest pretext version: $PTX_VERSION"
42+
echo "ptxversion=$PTX_VERSION" >> $GITHUB_ENV
4843
49-
- name: Build and push small
50-
if: ${{ github.event.inputs.container == 'all' || github.event.inputs.container == 'small' || github.event.inputs.container == ''}}
44+
- name: Build and push base
45+
if: ${{ github.event.inputs.container == 'all' || github.event.inputs.container == 'base' || github.event.inputs.container == '' }}
5146
uses: docker/build-push-action@v6
5247
with:
5348
platforms: linux/amd64,linux/arm64
5449
context: .
55-
file: ./small/Dockerfile
50+
file: ./base/Dockerfile
5651
push: true
57-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pretext:small
52+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pretext:${{ ptxversion }}
5853

5954
- name: Build and push full
6055
if: ${{ github.event.inputs.container == 'all' || github.event.inputs.container == 'full' || github.event.inputs.container == '' }}
6156
uses: docker/build-push-action@v6
6257
with:
6358
platforms: linux/amd64,linux/arm64
6459
context: .
60+
build-args: BASE_IMAGE_TAG=${{ ptxversion }}
6561
file: ./full/Dockerfile
6662
push: true
67-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pretext:full
63+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pretext-full:${{ ptxversion }}

base/Dockerfile

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+

full/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
FROM oscarlevin/pretext:small
1+
2+
ARG BASE_IMAGE_TAG
3+
4+
FROM oscarlevin/pretext:${BASE_IMAGE_TAG}
25

36
RUN apt-get update && \
47
apt-get install -y --no-install-recommends \

small/Dockerfile

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)