Skip to content

Publish Docker images #10

Publish Docker images

Publish Docker images #10

name: Publish Docker images
on:
release:
types: [published]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
debian-version: ["bullseye", "bookworm"]
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get current timestamp
id: timestamp
run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%SZ')"
- name: Get git commit SHA
id: git_sha
run: echo "::set-output name=git_sha::$(git rev-parse HEAD)"
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: engineervix/python-latex:${{ matrix.python-version }}-slim-${{ matrix.debian-version }}
labels: |
"org.opencontainers.image.title": "python-latex",
"org.opencontainers.image.description": "Python ${{ matrix.python-version }}-slim-${{ matrix.debian-version }} plus texlive and pandoc",
"org.opencontainers.image.url": "https://github.com/engineervix/docker-python-latex",
"org.opencontainers.image.source": "https://github.com/engineervix/docker-python-latex",
"org.opencontainers.image.version": "${{ matrix.python-version }}-slim-${{ matrix.debian-version }}",
"org.opencontainers.image.licenses": "MIT"
"org.opencontainers.image.created": "${{ steps.timestamp.outputs.timestamp }}",
"org.opencontainers.image.revision": "${{ steps.git_sha.outputs.git_sha }}"
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
DEBIAN_VERSION=${{ matrix.debian-version }}