Skip to content

Build and Push to Registry #234

Build and Push to Registry

Build and Push to Registry #234

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Build and Push to Registry
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
schedule:
- cron: 0 6 * * 1,4
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-versions:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.short-sha.outputs.sha }}
date: ${{ steps.date.outputs.date }}
steps:
- uses: benjlevesque/[email protected]
id: short-sha
- name: Get current date
id: date
run: echo "date=$(date -u +'%Y%m%d')" >> $GITHUB_OUTPUT
php-82:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: build-versions
permissions:
packages: write
env:
version: '8.2'
alternate_version: '8'
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: PHP ${{ env.version }} FPM
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile-fpm
build-args: |
PHP_VERSION=${{ env.version }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm
${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm
ghcr.io/${{ github.repository_owner }}/symfony:fpm
${{ github.repository_owner }}/symfony:fpm
ghcr.io/${{ github.repository_owner }}/symfony:latest
${{ github.repository_owner }}/symfony:latest
- name: PHP ${{ env.version }} FPM Alpine
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile-fpm
build-args: |
PHP_VERSION=${{ env.version }}
SUFFIX=-alpine
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm-alpine
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm-alpine
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm-alpine
${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm-alpine
ghcr.io/${{ github.repository_owner }}/symfony:fpm-alpine
${{ github.repository_owner }}/symfony:fpm-alpine
- name: PHP ${{ env.version }} Apache
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile-apache
build-args: |
PHP_VERSION=${{ env.version }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-apache
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-apache
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-apache
${{ github.repository_owner }}/symfony:${{ env.version }}-apache
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-apache
${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-apache
ghcr.io/${{ github.repository_owner }}/symfony:apache
${{ github.repository_owner }}/symfony:apache
php-81:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: build-versions
permissions:
packages: write
env:
version: '8.1'
alternate_version: '8.1'
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: PHP ${{ env.version }} FPM
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile-fpm
build-args: |
PHP_VERSION=${{ env.version }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm
${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm
- name: PHP ${{ env.version }} FPM Alpine
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile-fpm
build-args: |
PHP_VERSION=${{ env.version }}
SUFFIX=-alpine
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm-alpine
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm-alpine
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm-alpine
${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm-alpine
- name: PHP ${{ env.version }} Apache
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile-apache
build-args: |
PHP_VERSION=${{ env.version }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-apache
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-apache
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-apache
${{ github.repository_owner }}/symfony:${{ env.version }}-apache
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-apache
${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-apache
# This workflow contains a single job called "build"
php-80:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: build-versions
permissions:
packages: write
env:
version: '8.0'
alternate_version: '8.0'
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: PHP ${{ env.version }} FPM
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile-fpm
build-args: |
PHP_VERSION=${{ env.version }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm
${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm
- name: PHP ${{ env.version }} FPM Alpine
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile-fpm
build-args: |
PHP_VERSION=${{ env.version }}
SUFFIX=-alpine
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm-alpine
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-fpm-alpine
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine
${{ github.repository_owner }}/symfony:${{ env.version }}-fpm-alpine
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm-alpine
${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-fpm-alpine
- name: PHP ${{ env.version }} Apache
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile-apache
build-args: |
PHP_VERSION=${{ env.version }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-apache
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/cache/symfony:${{ env.version }}-apache
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.date }}
${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.date }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.sha }}
${{ github.repository_owner }}/symfony:${{ env.version }}-apache-${{ needs.build-versions.outputs.sha }}
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.version }}-apache
${{ github.repository_owner }}/symfony:${{ env.version }}-apache
ghcr.io/${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-apache
${{ github.repository_owner }}/symfony:${{ env.alternate_version }}-apache