Skip to content

Commit b67dbc2

Browse files
CI: update stuff
1 parent a3ebc54 commit b67dbc2

File tree

2 files changed

+24
-28
lines changed

2 files changed

+24
-28
lines changed

.docker/Dockerfile

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
1-
FROM ubuntu:22.04
1+
# Stage 1: Install TeX Live and dependencies (Cached)
2+
FROM alpine:latest AS builder
23

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

6-
# Install required packages
7-
RUN apt-get update && apt-get install -y \
8-
texlive-full \
7+
# Install texlive and other tex related packages to cache
8+
RUN apk add --no-cache \
9+
texlive \
10+
texlive-latex \
11+
texlive-latex-extra \
12+
texlive-fonts-extra \
13+
texlive-xetex \
14+
texlive-bibtex-extra \
915
latexmk \
10-
&& rm -rf /var/lib/apt/lists/*
16+
--repository=http://dl-cdn.alpinelinux.org/alpine/v3.18/main
17+
18+
# Stage 2: Final Image (Smaller and Faster)
19+
FROM alpine:latest
1120

12-
# Create a working directory
1321
WORKDIR /latex
1422

15-
# Copy compilation script
23+
# Copy only the necessary parts of TeX Live
24+
COPY --from=builder /usr/share/texmf-dist /usr/share/texmf-dist
25+
COPY --from=builder /usr/bin/latexmk /usr/bin/latexmk
26+
COPY --from=builder /usr/bin/xelatex /usr/bin/xelatex
27+
28+
# Copy your project files AFTER the TeX Live setup
1629
COPY entrypoint.sh /entrypoint.sh
1730
RUN chmod +x /entrypoint.sh
1831

.github/workflows/release.yml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,10 @@ jobs:
2222
id: changes
2323
run: |
2424
CHANGED=0
25-
# Fetch the latest changes
2625
git fetch origin main
27-
28-
# Check if there are more than one commit to compare against
29-
if [ "$(git rev-list --count HEAD)" -gt 1 ]; then
30-
# Ensure that there is more than 1 commit in the history
31-
if git diff --name-only HEAD^ HEAD | grep -E "^(.docker/|.*\.(tex|sty|cls)$)" > /dev/null; then
26+
if [[ $(git diff --name-only origin/main HEAD) =~ ^(\.docker\/|.*\.tex$|.*\.sty$|.*\.cls$) ]]; then
3227
CHANGED=1
33-
fi
34-
else
35-
# If there's no previous commit (only 1 commit), assume no changes to the relevant files
36-
echo "Only one commit or no previous commit, skipping change check."
37-
CHANGED=0
3828
fi
39-
4029
echo "changed=${CHANGED}" >> $GITHUB_OUTPUT
4130
4231
- name: Set up Docker
@@ -58,15 +47,9 @@ jobs:
5847
context: .docker
5948
push: true
6049
tags: ghcr.io/${{ github.repository }}/latex-builder:latest
61-
cache-from: |
62-
type=registry,ref=ghcr.io/${{ github.repository }}/latex-builder:buildcache
63-
type=registry,ref=ghcr.io/${{ github.repository }}/latex-builder:latest
50+
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/latex-builder:(buildcache,latest)
6451
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/latex-builder:buildcache,mode=max
6552

66-
- name: Pull latest Docker image
67-
if: steps.changes.outputs.changed == '1'
68-
run: docker pull ghcr.io/${{ github.repository }}/latex-builder:latest
69-
7053
- name: Build LaTeX document
7154
if: steps.changes.outputs.changed == '1'
7255
run: |

0 commit comments

Comments
 (0)