Builds - PHP #4
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: Builds - PHP | |
on: | |
workflow_dispatch: | |
inputs: | |
image: | |
default: "php" | |
required: false | |
type: string | |
registry: | |
default: "adeliom" | |
required: true | |
type: string | |
workflow_call: | |
inputs: | |
image: | |
default: "php" | |
required: false | |
type: string | |
registry: | |
default: "ghcr.io/agence-adeliom" | |
required: true | |
type: string | |
outputs: | |
repository: | |
value: ${{ jobs.base-images.repository.outputs.REPOSITORY }} | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
frankenphp: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["8.2", "8.3"] | |
variant: [frankenphp] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set image tag | |
run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT | |
id: image_tag | |
- name: Set repository | |
run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT | |
id: repository | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} | |
${{ runner.os }}-buildx-${{ matrix.version }} | |
- name: Build image amd64 | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
platforms: "linux/amd64" | |
load: true | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- name: Build and Push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
#platforms: "linux/amd64,linux/arm64" | |
platforms: "linux/amd64" | |
push: true | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
frankenphp-wkhtmltopdf: | |
runs-on: ubuntu-latest | |
needs: [frankenphp] | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["8.2", "8.3"] | |
variant: [frankenphp-wkhtmltopdf] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set image tag | |
run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT | |
id: image_tag | |
- name: Set repository | |
run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT | |
id: repository | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} | |
${{ runner.os }}-buildx-${{ matrix.version }} | |
- name: Build image amd64 | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
platforms: "linux/amd64" | |
load: true | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- name: Build and Push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
#platforms: "linux/amd64,linux/arm64" | |
platforms: "linux/amd64" | |
push: true | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
base: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["8.1", "8.2", "8.3", "8.4"] | |
variant: [cli, fpm] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set image tag | |
run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT | |
id: image_tag | |
- name: Set repository | |
run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT | |
id: repository | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} | |
${{ runner.os }}-buildx-${{ matrix.version }} | |
- name: Build image amd64 | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
platforms: "linux/amd64" | |
load: true | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- name: Build and Push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
#platforms: "linux/amd64,linux/arm64" | |
platforms: "linux/amd64" | |
push: true | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
wkhtmltopdf: | |
runs-on: ubuntu-latest | |
needs: [base] | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["8.1", "8.2", "8.3", "8.4"] | |
variant: [fpm-wkhtmltopdf, cli-wkhtmltopdf] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set image tag | |
run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT | |
id: image_tag | |
- name: Set repository | |
run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT | |
id: repository | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} | |
${{ runner.os }}-buildx-${{ matrix.version }} | |
- name: Build image amd64 | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
platforms: "linux/amd64" | |
load: true | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- name: Build and Push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
#platforms: "linux/amd64,linux/arm64" | |
platforms: "linux/amd64" | |
push: true | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
caddy: | |
runs-on: ubuntu-latest | |
needs: [base, wkhtmltopdf] | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["8.1", "8.2", "8.3", "8.4"] | |
variant: [caddy, caddy-wkhtmltopdf] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set image tag | |
run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT | |
id: image_tag | |
- name: Set repository | |
run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT | |
id: repository | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} | |
${{ runner.os }}-buildx-${{ matrix.version }} | |
- name: Build image amd64 | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
platforms: "linux/amd64" | |
load: true | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- name: Build and Push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
#platforms: "linux/amd64,linux/arm64" | |
platforms: "linux/amd64" | |
push: true | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
nginx: | |
runs-on: ubuntu-latest | |
needs: [base, wkhtmltopdf] | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["8.1", "8.2", "8.3", "8.4"] | |
variant: [nginx, nginx-wkhtmltopdf] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set image tag | |
run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT | |
id: image_tag | |
- name: Set repository | |
run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT | |
id: repository | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} | |
${{ runner.os }}-buildx-${{ matrix.version }} | |
- name: Build image amd64 | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
platforms: "linux/amd64" | |
load: true | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- name: Build and Push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
#platforms: "linux/amd64,linux/arm64" | |
platforms: "linux/amd64" | |
push: true | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
apache: | |
runs-on: ubuntu-latest | |
needs: [base, wkhtmltopdf] | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["8.1", "8.2", "8.3", "8.4"] | |
variant: [apache, apache-wkhtmltopdf] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set image tag | |
run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT | |
id: image_tag | |
- name: Set repository | |
run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT | |
id: repository | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} | |
${{ runner.os }}-buildx-${{ matrix.version }} | |
- name: Build image amd64 | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
platforms: "linux/amd64" | |
load: true | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- name: Build and Push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ inputs.image }} | |
file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} | |
#platforms: "linux/amd64,linux/arm64" | |
platforms: "linux/amd64" | |
push: true | |
tags: | | |
${{ steps.image_tag.outputs.IMAGE_TAG }} | |
build-args: | | |
PHP_VERSION=${{ matrix.version }} | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |