Skip to content

Commit

Permalink
switch to pdfLatex
Browse files Browse the repository at this point in the history
  • Loading branch information
anishshobithps committed Jan 12, 2025
1 parent d9ebce8 commit 61fbd8c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 20 deletions.
41 changes: 30 additions & 11 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
FROM ubuntu:22.04
# Stage 1: Builder with all necessary packages
FROM alpine:latest AS builder

# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# Install build dependencies in a single layer to optimize caching
RUN apk add --no-cache \
texlive \
texlive-xetex \
texmf-dist \
texmf-dist-latexextra \
texmf-dist-fontsextra \
perl \
fontconfig \
make \
&& texhash

# Install required packages
RUN apt-get update && apt-get install -y \
texlive-full \
latexmk \
&& rm -rf /var/lib/apt/lists/*
# Stage 2: Final image with only runtime dependencies
FROM alpine:latest

# Install minimal runtime dependencies
RUN apk add --no-cache \
texlive-xetex \
texmf-dist \
fontconfig

# Copy texmf files from builder
COPY --from=builder /usr/share/texmf-dist /usr/share/texmf-dist

# Create a working directory
WORKDIR /latex

# Copy compilation script
# Copy your LaTeX files
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY *.tex *.cls *.sty ./

# Make entrypoint executable and refresh TeX file database
RUN chmod +x /entrypoint.sh && \
texhash

ENTRYPOINT ["/entrypoint.sh"]
18 changes: 9 additions & 9 deletions .docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ mkdir -p /latex/output
# Ensure TeX can find the files
texhash

# Run XeLaTeX with proper output name
xelatex -interaction=nonstopmode \
-output-directory=/latex/output \
-jobname="Anish_Shobith_P_S_Resume" \
"main.tex"
# Run pdfLaTeX with proper output name
pdflatex -interaction=nonstopmode \
-output-directory=/latex/output \
-jobname="Anish_Shobith_P_S_Resume" \
"main.tex"

# Run again for references if needed
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"
pdflatex -interaction=nonstopmode \
-output-directory=/latex/output \
-jobname="Anish_Shobith_P_S_Resume" \
"main.tex"
fi

# Copy the final PDF to the mounted volume
Expand Down

0 comments on commit 61fbd8c

Please sign in to comment.