Skip to content

Bump docker/build-push-action from 5 to 6 #56

Bump docker/build-push-action from 5 to 6

Bump docker/build-push-action from 5 to 6 #56

Workflow file for this run

name: Publish Docker Image
# https://www.docker.com/blog/first-docker-github-action-is-here
# https://github.com/docker/build-push-action
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
env:
PUSH_TO_HUB: ${{ github.ref == 'refs/heads/master' }}
jobs:
build-push:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
if: env.PUSH_TO_HUB == 'true'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Publish to Docker Hub
# publish master
uses: docker/build-push-action@v6
# https://github.com/docker/build-push-action#cache-to-registry
with:
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
cache-from: type=registry,ref=borda/docker_sample:py${{ matrix.python-version }}
cache-to: type=inline
file: Dockerfile
push: ${{ env.PUSH_TO_HUB }}
tags: borda/docker_sample:py${{ matrix.python-version }}
timeout-minutes: 25