Skip to content

Commit

Permalink
CI: update stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
anishshobithps committed Jan 11, 2025
1 parent a3ebc54 commit b67dbc2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 28 deletions.
31 changes: 22 additions & 9 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
FROM ubuntu:22.04
# Stage 1: Install TeX Live and dependencies (Cached)
FROM alpine:latest AS builder

# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies (these rarely change)
RUN apk add --no-cache git bash wget

# Install required packages
RUN apt-get update && apt-get install -y \
texlive-full \
# 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 \
&& rm -rf /var/lib/apt/lists/*
--repository=http://dl-cdn.alpinelinux.org/alpine/v3.18/main

# Stage 2: Final Image (Smaller and Faster)
FROM alpine:latest

# Create a working directory
WORKDIR /latex

# Copy compilation script
# 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 your project files AFTER the TeX Live setup
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

Expand Down
21 changes: 2 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,10 @@ jobs:
id: changes
run: |
CHANGED=0
# Fetch the latest changes
git fetch origin main
# Check if there are more than one commit to compare against
if [ "$(git rev-list --count HEAD)" -gt 1 ]; then
# Ensure that there is more than 1 commit in the history
if git diff --name-only HEAD^ HEAD | grep -E "^(.docker/|.*\.(tex|sty|cls)$)" > /dev/null; then
if [[ $(git diff --name-only origin/main HEAD) =~ ^(\.docker\/|.*\.tex$|.*\.sty$|.*\.cls$) ]]; then
CHANGED=1
fi
else
# If there's no previous commit (only 1 commit), assume no changes to the relevant files
echo "Only one commit or no previous commit, skipping change check."
CHANGED=0
fi
echo "changed=${CHANGED}" >> $GITHUB_OUTPUT
- name: Set up Docker
Expand All @@ -58,15 +47,9 @@ jobs:
context: .docker
push: true
tags: ghcr.io/${{ github.repository }}/latex-builder:latest
cache-from: |
type=registry,ref=ghcr.io/${{ github.repository }}/latex-builder:buildcache
type=registry,ref=ghcr.io/${{ github.repository }}/latex-builder:latest
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/latex-builder:(buildcache,latest)
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/latex-builder:buildcache,mode=max

- name: Pull latest Docker image
if: steps.changes.outputs.changed == '1'
run: docker pull ghcr.io/${{ github.repository }}/latex-builder:latest

- name: Build LaTeX document
if: steps.changes.outputs.changed == '1'
run: |
Expand Down

0 comments on commit b67dbc2

Please sign in to comment.