Skip to content

Update docker-publish.yml #7

Update docker-publish.yml

Update docker-publish.yml #7

name: Build and Push Docker Image
on:
workflow_dispatch:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
python-version: [ "3.10", "3.11", "3.12" ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build Docker image with a custom Python version
- name: Build Docker image (Python ${{ matrix.python-version }})
run: |
docker build \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
-t ghcr.io/jageo/autoplex/autoplex:python-${{ matrix.python-version }} .
# Push Docker image to GHCR
- name: Push Docker image to GHCR (Python ${{ matrix.python-version }})
run: |
docker push ghcr.io/jageo/autoplex/autoplex:python-${{ matrix.python-version }}