Skip to content

Commit 00265c1

Browse files
authored
DX: push Docker containers for LaTeX workflows (#388)
1 parent 5127017 commit 00265c1

File tree

6 files changed

+110
-2
lines changed

6 files changed

+110
-2
lines changed

.cspell.json

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"conf.py",
5858
"data/**.json",
5959
"data/**.yaml",
60+
"Dockerfile*",
6061
"docs/_templates/*",
6162
"julia/**",
6263
"LICENSE",

.github/Dockerfile.latex

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:24.04
2+
LABEL org.opencontainers.image.description=" \
3+
This image is used by the ci-docs.yml workflow of the ComPWA/polarimetry \
4+
repository to generate an HTML build as well as a PDF for the documentation \
5+
with notebook outputs (Jupyter notebook job). The LaTeX packages are required \
6+
for building the PDF file and for having matplotlib plots with LaTeX. \
7+
"
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
ENV HOME=/workspace
10+
RUN apt-get update && \
11+
apt-get install -y --no-install-recommends \
12+
cm-super \
13+
dvipng \
14+
git \
15+
inkscape \
16+
latexmk \
17+
make \
18+
texlive-fonts-extra \
19+
texlive-latex-extra \
20+
texlive-xetex \
21+
xindy && \
22+
apt-get clean && \
23+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
24+
WORKDIR /workspace
25+
CMD ["/bin/bash"]

.github/Dockerfile.latex-small

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM ubuntu:24.04
2+
LABEL org.opencontainers.image.description=" \
3+
This image is used by the ci-docs.yml workflow of the ComPWA/polarimetry \
4+
repository to generate a PDF for the documentation without notebook outputs \
5+
(fast-pdf job). The LaTeX packages are required for building the PDF file and \
6+
for having matplotlib plots with LaTeX. \
7+
"
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
ENV HOME=/workspace
10+
RUN apt-get update && \
11+
apt-get install -y --no-install-recommends \
12+
git \
13+
inkscape \
14+
latexmk \
15+
make \
16+
texlive-fonts-extra \
17+
texlive-xetex \
18+
xindy && \
19+
apt-get clean && \
20+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
21+
WORKDIR /workspace
22+
CMD ["/bin/bash"]

.github/workflows/latex-image.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish Docker images
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
image-tag:
7+
default: latest
8+
description: The tag of the image to build and push
9+
required: true
10+
11+
jobs:
12+
create-image:
13+
name: Create Docker image
14+
runs-on: ubuntu-24.04
15+
permissions:
16+
packages: write
17+
contents: read
18+
attestations: write
19+
id-token: write
20+
strategy:
21+
matrix:
22+
image-name:
23+
- latex
24+
- latex-small
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: Log in to GitHub Container Registry
28+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # https://github.com/docker/login-action/releases/tag/v3.3.0
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # https://github.com/docker/metadata-action/releases/tag/v5.7.0
36+
with:
37+
images: ghcr.io/compwa/polarimetry-${{ matrix.image-name }}
38+
- name: Build and push Docker images
39+
id: push
40+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # https://github.com/docker/build-push-action/releases/tag/v6.15.0
41+
with:
42+
context: .
43+
file: .github/Dockerfile.${{ matrix.image-name }}
44+
labels: ${{ steps.meta.outputs.labels }}
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
- name: Build Inventory Image
48+
run: |
49+
docker build -f .github/Dockerfile.${{ matrix.image-name }} . --tag ghcr.io/compwa/polarimetry-${{ matrix.image-name }}:${{ github.event.inputs.image-tag }}
50+
docker push ghcr.io/compwa/polarimetry-${{ matrix.image-name }}:${{ github.event.inputs.image-tag }}
51+
- name: Generate artifact attestation
52+
uses: actions/attest-build-provenance@v2
53+
with:
54+
subject-name: ghcr.io/compwa/polarimetry-${{ matrix.image-name }}
55+
subject-digest: ${{ steps.push.outputs.digest }}
56+
push-to-registry: true

.vscode/extensions.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"github.vscode-pull-request-github",
1111
"julialang.language-julia",
1212
"mhutchie.git-graph",
13+
"ms-azuretools.vscode-docker",
1314
"ms-python.mypy-type-checker",
1415
"ms-python.python",
1516
"ms-python.vscode-pylance",

.vscode/settings.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"[dockerfile]": {
3+
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
4+
},
25
"[git-commit]": {
36
"editor.rulers": [72],
47
"rewrap.wrappingColumn": 72
@@ -37,8 +40,8 @@
3740
"\u03c3": true
3841
},
3942
"files.associations": {
40-
"**/pixi.lock": "yaml",
41-
".cspell/*.txt": "plaintext"
43+
".cspell/*.txt": "plaintext",
44+
"**/pixi.lock": "yaml"
4245
},
4346
"files.eol": "\n",
4447
"github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"],

0 commit comments

Comments
 (0)