Skip to content

Publish Python container images based on Ubuntu #30

Publish Python container images based on Ubuntu

Publish Python container images based on Ubuntu #30

name: Publish Python container images based on Ubuntu
on:
schedule:
- cron: '0 17 * * 2'
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{github.repository_owner}}/python
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.11]
ubuntu: [lunar]
permissions:
packages: write
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
config-inline: |
[worker.oci]
max-parallelism = 1
- name: Log into registry ${{env.REGISTRY}}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{env.REGISTRY}}
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}
tags: |
type=raw,${{matrix.python}}-${{matrix.ubuntu}}
labels: |
org.opencontainers.image.title=Python ${{matrix.python}} container image based on Ubuntu ${{matrix.ubuntu}}
org.opencontainers.image.description=Python ${{matrix.python}} container image based on Ubuntu ${{matrix.ubuntu}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: '{{defaultContext}}:python/${{matrix.python}}/${{matrix.ubuntu}}'
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le, linux/s390x
push: ${{github.event_name != 'pull_request'}}
tags: ${{steps.meta.outputs.tags}}
labels: ${{steps.meta.outputs.labels}}