Skip to content

Docker Publish

Docker Publish #19

name: Docker Publish
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
env:
REGISTRY: docker.io
IMAGE_NAME: biggates/poetry
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
strategy:
matrix:
python_version: ["3.12-slim", "3.11-slim", "3.10-slim", "3.9-slim", "3.8-slim"]
poetry_version: ["1.6.0", "1.7.1", "1.8.2"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Download poetry installer
run: |
wget -q -S -O install.py https://install.python-poetry.org
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build and push docker image
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: biggates/poetry:${{ matrix.poetry_version }}-py${{ matrix.python_version }}
build-args: |
PYTHON_IMAGE=${{ matrix.python_version }}
POETRY_VERSION=${{ matrix.poetry_version }}