Skip to content

Commit b26ce4f

Browse files
committed
Add Alpine and Ubuntu Typst images
stack=ubuntu
1 parent 159bee4 commit b26ce4f

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed

.github/workflows/build.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ jobs:
120120
if: ${{ matrix.stack != 'static' }}
121121
run: make latex
122122

123+
- name: Build Typst image
124+
if: ${{ matrix.stack != 'static' }}
125+
run: make typst
126+
123127
- name: Build extra image
124128
if: ${{ matrix.stack != 'static' }}
125129
run: make extra
@@ -147,6 +151,7 @@ jobs:
147151
make push-minimal
148152
if [ "$STACK" != 'static' ]; then
149153
make push-core
154+
make push-typst
150155
make push-latex
151156
make push-extra
152157
fi

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,17 @@ $(1) $(1)-minimal $(1)-freeze-file: STACK = $(1)
6969
$(1): $(1)-minimal
7070
$(1)-minimal: minimal
7171
$(1)-freeze-file: $(1)/$(stack_freeze_file)
72-
# Only alpine and ubuntu support core, latex, and extra images
72+
# Only alpine and ubuntu support core, latex, typst, and extra images
7373
ifeq ($(1),$(filter $(1),alpine ubuntu))
7474
.PHONY: \
7575
$(1)-core \
7676
$(1)-latex \
77+
$(1)-typst \
7778
$(1)-extra
78-
$(1) $(1)-core $(1)-latex $(1)-extra: STACK = $(1)
79+
$(1) $(1)-core $(1)-latex $(1)-typst $(1)-extra: STACK = $(1)
7980
$(1)-core: core
8081
$(1)-latex: latex
82+
$(1)-typst: typst
8183
$(1)-extra: extra
8284
endif
8385

@@ -168,6 +170,16 @@ latex: $(STACK)/$(stack_freeze_file)
168170
-d "$(makefile_dir)" \
169171
-t "$(STACK)-latex" \
170172
$(docker_cpu_options)
173+
# Typst #################################################################
174+
.PHONY: typst
175+
typst: $(STACK)/$(stack_freeze_file)
176+
./build.sh build -v \
177+
-r typst \
178+
-s "$(STACK)" \
179+
-c "$(PANDOC_COMMIT)" \
180+
-d "$(makefile_dir)" \
181+
-t "$(STACK)-typst" \
182+
$(docker_cpu_options)
171183
# Extra #################################################################
172184
.PHONY: extra
173185
extra: $(STACK)/$(stack_freeze_file)

alpine/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ARG extra_packages="pandoc-cli pandoc-crossref"
5050
# Build pandoc and pandoc-crossref. The `allow-newer` is required for
5151
# when pandoc-crossref has not been updated yet, but we want to build
5252
# anyway.
53-
RUN cabal build \
53+
RUN cabal update && cabal build \
5454
--allow-newer 'lib:pandoc' \
5555
--disable-tests \
5656
--disable-bench \
@@ -161,6 +161,11 @@ RUN echo "binary_x86_64-linuxmusl 1" >> /root/texlive.profile \
161161

162162
WORKDIR /data
163163

164+
# Typst #################################################################
165+
FROM alpine-core AS alpine-typst
166+
167+
RUN apk --no-cache add typst
168+
164169
# extra ##############################################################
165170
FROM alpine-latex AS alpine-extra
166171

ubuntu/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,40 @@ RUN ( [ -z "$texlive_version" ] || printf '-t\n%s\n"' "$texlive_version" \
161161

162162
WORKDIR /data
163163

164+
# typst ##############################################################
165+
FROM ubuntu-core as ubuntu-typst
166+
167+
RUN set -eux; \
168+
apt-get -q --no-allow-insecure-repositories update; \
169+
apt-get install --assume-yes --no-install-recommends --mark-auto \
170+
curl dpkg-dev tar; \
171+
cd /tmp; \
172+
ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)"; \
173+
TYPST_GITHUB="https://github.com/typst/typst/releases/download/"; \
174+
TYPST_VERSION="v0.11.1"; \
175+
TYPST_BUILD="typst-${ARCH}-unknown-linux-musl"; \
176+
TYPST_URL="$TYPST_GITHUB/$TYPST_VERSION/$TYPST_BUILD.tar.xz"; \
177+
case "$ARCH" in \
178+
('aarch64') \
179+
TYPST_SHA256='7f14f7fb37b26febffd13e683f90cdacddfde420d5fdc7f809228a78545c4b26'; \
180+
;; \
181+
('x86_64') \
182+
TYPST_SHA256='bb637d1d65634b2ee4b4e101d0b2d541bf3f1e03ac5f51f9619941e48dd28bd0'; \
183+
;; \
184+
(*) echo >&2 "error: unsupported architecture '$ARCH'"; \
185+
exit 1 \
186+
;; \
187+
esac; \
188+
curl -sSL "$TYPST_URL" -o typst.tar.xz; \
189+
echo "$TYPST_SHA256 typst.tar.xz" | sha256sum --strict --check; \
190+
tar -xf typst.tar.xz \
191+
-C /usr/local/bin \
192+
--strip-components=1 \
193+
"$TYPST_BUILD/typst"; \
194+
apt-get autoremove --purge --assume-yes; \
195+
rm typst.tar.xz; \
196+
rm -rf /var/lib/apt/lists/*;
197+
164198
# extra ##############################################################
165199
FROM ubuntu-latex AS ubuntu-extra
166200

0 commit comments

Comments
 (0)