Skip to content

build image and push to DockerHub #339

build image and push to DockerHub

build image and push to DockerHub #339

Workflow file for this run

name: build image and push to DockerHub
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "30 0 1,2,3,4,5,6,7 * 0"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/[email protected]
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./
file: ./Dockerfile.${{ matrix.version }}
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
push: ${{ github.event_name != 'pull_request' }}
pull: true
cache-from: type=registry,ref=xr09/python-requests:${{ matrix.version }}
cache-to: type=inline
tags: |
xr09/python-requests:${{ matrix.version }}
- name: Image digest
if: ${{ matrix.version }} == $PYTHON_LATEST
run: echo ${{ steps.docker_build.outputs.digest }}
build-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/[email protected]
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Push latest
id: docker_build_latest
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./
file: ./Dockerfile.3.12
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
push: ${{ github.event_name != 'pull_request' }}
pull: true
cache-from: type=registry,ref=xr09/python-requests:latest
cache-to: type=inline
tags: |
xr09/python-requests:latest
xr09/python-requests:3.12