Skip to content

Commit

Permalink
Merge pull request #7 from orensbruli/feature/improve_dockerfile
Browse files Browse the repository at this point in the history
Better Dockerfile
  • Loading branch information
orensbruli authored Jan 17, 2024
2 parents 4b32765 + 1e9bdd3 commit 592a3c7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/github_action_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -38,7 +30,7 @@ jobs:
- name: Upload PDF as Artifact
uses: actions/upload-artifact@v4
with:
name: compiled-pdf
name: compiled-pdf-${{ github.ref_slug }}
path: output.pdf

- name: Upload binaries to release
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,7 @@ TSWLatexianTemp*
*.lpz

build/

*.pdf

*.eps
24 changes: 11 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

# Use an official Ubuntu base image
FROM ubuntu:22.04

# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive

# Install LaTeX packages
# Install LaTeX packages and other dependencies in one RUN command to minimize layers
RUN apt-get update && apt-get install -y \
make \
pandoc \
Expand All @@ -17,21 +16,20 @@ RUN apt-get update && apt-get install -y \
texlive-luatex \
texlive-pstricks \
texlive-xetex \
wget

RUN wget --output-document=/usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && \
chmod +x /usr/local/bin/yq && \
yq --version

RUN apt-get update && apt-get install -y \
fonts-roboto-slab

RUN apt-get update && apt-get install -y \
wget \
fonts-roboto-slab \
ghostscript \
python3 \
python3-pip
python3-pip \
&& wget --output-document=/usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
&& chmod +x /usr/local/bin/yq \
&& yq --version \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# bind mount requirements.txt and install python dependencies
# Note: This will only work during a Docker build if you use BuildKit, otherwise, you need to copy the requirements.txt file
# and run pip install as a separate step during container runtime.
RUN --mount=type=bind,target=/latex_content pip3 install -r /latex_content/requirements.txt

# Set working directory
Expand Down

0 comments on commit 592a3c7

Please sign in to comment.