Build and push containers #446
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build and push containers" | |
on: | |
schedule: | |
- cron: '31 19 * * *' | |
push: | |
branches: [ main ] | |
jobs: | |
release-container: | |
name: "Push Docker image to GitHub Packages" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php-version: | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
base-image: | |
- "alpine" | |
- "debian" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v3" | |
- name: "Docker meta" | |
id: "meta" | |
uses: "docker/metadata-action@v4" | |
with: | |
flavor: | | |
latest=false | |
images: | | |
core23/jenkins-php-agent | |
ghcr.io/core23/jenkins-php-agent | |
tags: | | |
type=raw,value=${{ matrix.php-version }}-${{ matrix.base-image }} | |
type=raw,value=${{ matrix.php-version }},enable=${{ startsWith(matrix.base-image, 'debian') }} | |
- name: "Setup QEMU" | |
uses: "docker/setup-qemu-action@v2" | |
- name: "Setup Docker Buildx" | |
uses: "docker/setup-buildx-action@v2" | |
- name: "Login to GitHub Container Registry" | |
uses: "docker/login-action@v2" | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CONTAINER_GH_USERNAME }} | |
password: ${{ secrets.CONTAINER_GH_PAT }} | |
- name: "Login to DockerHub Registry" | |
uses: "docker/login-action@v2" | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: "Build and push" | |
uses: "docker/build-push-action@v4" | |
with: | |
context: "php/${{ matrix.base-image }}/${{ matrix.php-version }}" | |
platforms: "linux/amd64" | |
push: true | |
tags: "${{ steps.meta.outputs.tags }}" | |
labels: "${{ steps.meta.outputs.labels }}" |