Skip to content

Commit

Permalink
CI & Docker: Update
Browse files Browse the repository at this point in the history
  • Loading branch information
anishshobithps committed Jan 11, 2025
1 parent d5e54f7 commit 81ec2e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
15 changes: 8 additions & 7 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Stage 1: Builder with all necessary packages
FROM alpine:latest AS builder

# Install build dependencies
# Install build dependencies in a single layer to optimize caching
RUN apk add --no-cache \
texlive \
texlive-xetex \
Expand All @@ -10,28 +10,29 @@ RUN apk add --no-cache \
texmf-dist-fontsextra \
perl \
fontconfig \
make
make \
&& texhash

# Stage 2: Final image with only runtime dependencies
FROM alpine:latest

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

# Copy necessary files from builder
# Copy texmf 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 your LaTeX files
COPY entrypoint.sh /entrypoint.sh
COPY *.tex *.cls *.sty ./

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

ENTRYPOINT ["/entrypoint.sh"]
12 changes: 11 additions & 1 deletion .docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ set -e
# Create output directory
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 again if needed for references
# 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 \
Expand All @@ -20,3 +23,10 @@ fi

# Copy the final PDF to the mounted volume
cp /latex/output/Anish_Shobith_P_S_Resume.pdf /latex/

# Show compilation log in case of errors
if [ ! -f "/latex/Anish_Shobith_P_S_Resume.pdf" ]; then
echo "Compilation failed. Log output:"
cat /latex/output/Anish_Shobith_P_S_Resume.log
exit 1
fi

0 comments on commit 81ec2e4

Please sign in to comment.