-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b67dbc2
commit 670da75
Showing
2 changed files
with
40 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
# Stage 1: Install TeX Live and dependencies (Cached) | ||
FROM alpine:latest AS builder | ||
|
||
# Install system dependencies (these rarely change) | ||
RUN apk add --no-cache git bash wget | ||
|
||
# Install texlive and other tex related packages to cache | ||
RUN apk add --no-cache \ | ||
texlive \ | ||
texlive-latex \ | ||
texlive-latex-extra \ | ||
texlive-fonts-extra \ | ||
texlive-xetex \ | ||
texlive-bibtex-extra \ | ||
latexmk \ | ||
--repository=http://dl-cdn.alpinelinux.org/alpine/v3.18/main | ||
|
||
# Stage 2: Final Image (Smaller and Faster) | ||
# Stage 1: TeX Live Base | ||
FROM alpine:latest AS builder-texlive | ||
|
||
RUN apk add --no-cache git bash wget perl # Perl is required by tlmgr | ||
RUN apk add --no-cache texlive --repository=http://dl-cdn.alpinelinux.org/alpine/v3.18/main | ||
ENV PATH="/usr/local/texlive/2023/bin/x86_64-linux:$PATH" | ||
RUN tlmgr update --self | ||
RUN tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet | ||
|
||
# Stage 2: Fonts and Packages | ||
FROM builder-texlive AS builder-fonts | ||
|
||
RUN tlmgr install xcharter | ||
RUN tlmgr install enumitem hyperref titlesec xstring geometry fancyhdr etoolbox | ||
|
||
# Stage 3: Final Image | ||
FROM alpine:latest | ||
|
||
WORKDIR /latex | ||
|
||
# Copy only the necessary parts of TeX Live | ||
COPY --from=builder /usr/share/texmf-dist /usr/share/texmf-dist | ||
COPY --from=builder /usr/bin/latexmk /usr/bin/latexmk | ||
COPY --from=builder /usr/bin/xelatex /usr/bin/xelatex | ||
# Copy necessary files | ||
COPY --from=builder-fonts /usr/local/texlive/2023/texmf-dist /usr/local/texlive/2023/texmf-dist | ||
COPY --from=builder-fonts /usr/local/texlive/2023/bin/x86_64-linux/xelatex /usr/local/texlive/2023/bin/x86_64-linux/xelatex | ||
COPY --from=builder-fonts /usr/local/texlive/2023/bin/x86_64-linux/latexmk /usr/local/texlive/2023/bin/x86_64-linux/latexmk | ||
|
||
# Copy your project files AFTER the TeX Live setup | ||
ENV PATH="/usr/local/texlive/2023/bin/x86_64-linux:$PATH" | ||
COPY entrypoint.sh /entrypoint.sh | ||
COPY *.tex *.bib *.cls /latex/ | ||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters