-
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
2a2e2fc
commit d5e54f7
Showing
3 changed files
with
83 additions
and
52 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,30 +1,37 @@ | ||
# 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 | ||
|
||
# Install TeX Live and set PATH in one step | ||
RUN apk add --no-cache texlive texlive-full --repository=http://dl-cdn.alpinelinux.org/alpine/v3.18/main \ | ||
&& echo "/usr/local/texlive/2024/bin/x86_64-linux:$PATH" > /etc/profile.d/texlive.sh | ||
# Stage 1: Builder with all necessary packages | ||
FROM alpine:latest AS builder | ||
|
||
# Install build dependencies | ||
RUN apk add --no-cache \ | ||
texlive \ | ||
texlive-xetex \ | ||
texmf-dist \ | ||
texmf-dist-latexextra \ | ||
texmf-dist-fontsextra \ | ||
perl \ | ||
fontconfig \ | ||
make | ||
|
||
# Stage 2: Final image with only runtime dependencies | ||
FROM alpine:latest | ||
|
||
# Stage 2: Fonts and Packages | ||
FROM builder-texlive AS builder-fonts | ||
# Install only runtime dependencies | ||
RUN apk add --no-cache \ | ||
texlive-xetex \ | ||
texmf-dist \ | ||
fontconfig | ||
|
||
RUN tlmgr install xcharter enumitem hyperref titlesec xstring geometry fancyhdr etoolbox | ||
|
||
# Stage 3: Final Image | ||
FROM alpine:latest | ||
# Copy necessary files from builder | ||
COPY --from=builder /usr/share/texmf-dist /usr/share/texmf-dist | ||
COPY --from=builder /usr/share/texlive /usr/share/texlive | ||
COPY --from=builder /var/lib/texmf /var/lib/texmf | ||
|
||
WORKDIR /latex | ||
|
||
# Copy necessary files | ||
COPY --from=builder-fonts /usr/local/texlive/2024/texmf-dist /usr/local/texlive/2024/texmf-dist | ||
COPY --from=builder-fonts /usr/local/texlive/2024/bin/x86_64-linux/xelatex /usr/local/texlive/2024/bin/x86_64-linux/xelatex | ||
COPY --from=builder-fonts /usr/local/texlive/2024/bin/x86_64-linux/latexmk /usr/local/texlive/2024/bin/x86_64-linux/latexmk | ||
|
||
# No need to set PATH again, it's already set in Stage 1 | ||
# Copy your LaTeX files | ||
COPY entrypoint.sh /entrypoint.sh | ||
COPY *.tex *.bib *.cls /latex/ | ||
COPY *.tex *.cls *.sty ./ | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
set -e | ||
|
||
INPUT_FILE="$1" | ||
OUTPUT_NAME="${2:-output.pdf}" # Default to output.pdf if no name specified | ||
# Create output directory | ||
mkdir -p /latex/output | ||
|
||
# Compile the LaTeX document | ||
latexmk -pdf "$INPUT_FILE" | ||
# Run XeLaTeX with proper output name | ||
xelatex -interaction=nonstopmode \ | ||
-output-directory=/latex/output \ | ||
-jobname="Anish_Shobith_P_S_Resume" \ | ||
"main.tex" | ||
|
||
# Get the base name of the input file without extension | ||
BASE_NAME=$(basename "$INPUT_FILE" .tex) | ||
# Run again if needed for references | ||
if grep -q "Rerun to get" "/latex/output/Anish_Shobith_P_S_Resume.log"; then | ||
xelatex -interaction=nonstopmode \ | ||
-output-directory=/latex/output \ | ||
-jobname="Anish_Shobith_P_S_Resume" \ | ||
"main.tex" | ||
fi | ||
|
||
# Rename the output file | ||
mv "${BASE_NAME}.pdf" "$OUTPUT_NAME" | ||
# Copy the final PDF to the mounted volume | ||
cp /latex/output/Anish_Shobith_P_S_Resume.pdf /latex/ |
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