Skip to content
This repository was archived by the owner on Sep 5, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 15 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
FROM rust:slim AS typ2docx
RUN apt update && apt install -y --no-install-recommends \
curl pkg-config libssl-dev
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
FROM rust:alpine AS typ2docx

Copilot AI Dec 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gcompat package provides GNU libc compatibility for musl-based Alpine, which is needed for Python packages like saxonche (listed in pyproject.toml) that have glibc dependencies. However, gcompat may not fully support all glibc features. Consider testing thoroughly to ensure all Python dependencies (especially saxonche, pdfservices-sdk, and pdf2docx) work correctly with musl/gcompat, or document any known limitations.

Suggested change
FROM rust:alpine AS typ2docx
FROM rust:alpine AS typ2docx
# NOTE: gcompat provides partial GNU libc compatibility for musl-based Alpine.
# Some Python packages (e.g., saxonche, pdfservices-sdk, pdf2docx) may require full glibc support.
# gcompat may not fully support all glibc features; test these packages thoroughly and document any known limitations.

Copilot uses AI. Check for mistakes.
RUN apk add --no-cache pkgconfig openssl-dev gcompat
COPY pyproject.toml /
RUN /root/.local/bin/uv tool install typ2docx --verbose
RUN uv tool install typ2docx --python-platform x86_64-manylinux_2_40 --verbose

# align with oven/bun:slim
FROM rust:slim-bookworm AS typst
RUN apt update && apt install -y --no-install-recommends pkg-config libssl-dev
COPY Cargo.toml /
RUN cargo install typst-cli
FROM alpine:edge AS typst
RUN apk add --no-cache typst

Comment on lines +6 to 8

Copilot AI Dec 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using alpine:edge provides the latest rolling release packages but can introduce instability and breaking changes. Consider using a stable Alpine version (e.g., alpine:3.20) with an explicit typst version for better reproducibility and reliability in production environments.

Suggested change
FROM alpine:edge AS typst
RUN apk add typst
FROM alpine:3.20 AS typst
RUN apk add --no-cache ca-certificates wget tar
# Install specific typst version (e.g., v0.10.0)
ENV TYPST_VERSION=0.10.0
RUN wget -O typst.tar.xz https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-x86_64-unknown-linux-musl.tar.xz \
&& tar -xf typst.tar.xz \
&& mv typst-x86_64-unknown-linux-musl/typst /usr/bin/typst \
&& rm -rf typst-x86_64-unknown-linux-musl typst.tar.xz

Copilot uses AI. Check for mistakes.
FROM alpine/curl AS pandoc
ARG PLATFORM=linux-amd64
ARG REPO=https://github.com/jgm/pandoc
ARG VERSION=3.8.3
ARG FILE=pandoc-${VERSION}-${PLATFORM}.tar.gz
RUN curl -L "${REPO}/releases/download/${VERSION}/${FILE}" | tar -xz
FROM pandoc/minimal AS pandoc

FROM oven/bun:slim
RUN apt update && \
apt install -y --no-install-recommends ca-certificates unzip rsync zip && \
rm -rf /var/lib/apt/lists/
COPY --from=pandoc /pandoc-*/bin/pandoc /usr/local/bin/
COPY --from=typst /usr/local/cargo/bin/typst /usr/local/bin/
COPY --from=typ2docx /root/.local/bin/typ2docx /usr/local/bin/
FROM oven/bun:alpine
RUN apk add --no-cache \
ca-certificates gcompat unzip rsync zip libxml2
COPY --from=pandoc /usr/local/bin/pandoc /usr/bin/
COPY --from=typst /usr/bin/typst /usr/bin/
COPY --from=typ2docx /root/.local/bin/typ2docx /usr/bin/
COPY --from=typ2docx /root/.local/share/uv/ /root/.local/share/uv/
COPY server.ts /
COPY index.html /
CMD ["bun", "server.ts"]
COPY server.ts ./
COPY index.html ./
CMD ["./server.ts"]