diff --git a/.docker/Dockerfile b/.docker/Dockerfile index a8d676e..bfc2f9b 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -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"] diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh index 028fccb..0117434 100644 --- a/.docker/entrypoint.sh +++ b/.docker/entrypoint.sh @@ -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