Skip to content

chore(deps): update docker/login-action action to v3 #267

chore(deps): update docker/login-action action to v3

chore(deps): update docker/login-action action to v3 #267

Workflow file for this run

name: Docker Build
on: push
env:
TEST_TAG: ${{ github.repository }}:test
jobs:
build:
name: Build ${{ matrix.php_version }}-composer${{ matrix.composer_version }}-${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
php_version: ["7.4", "8.0", "8.1", "8.2"]
composer_version: ["1", "2"]
target: ["base", "onbuild"]
platforms: ["linux/amd64,linux/arm64/v8"]
include:
- php_version: "7.4"
composer_version: "2"
target: "onbuild"
latest_major: "true"
- php_version: "7.4"
composer_version: "1"
target: "onbuild"
latest_major: "true"
- php_version: "8.2"
composer_version: "1"
target: "onbuild"
latest_major: "true"
- php_version: "8.2"
composer_version: "2"
target: "onbuild"
latest: "true"
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
clevyr/php
ghcr.io/clevyr/php
flavor: latest=false
tags: |
# latest
type=raw,enable=${{ matrix.latest == 'true' }},value=latest
# {{major}}.{{minor}}-composer{{major}}-target
type=semver,pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }}-${{ matrix.target }},value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-composer{{major}}
type=semver,enable=${{ matrix.target == 'onbuild' }},pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }},value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-target
type=semver,enable=${{ matrix.composer_version == '2' }},pattern={{major}}.{{minor}},suffix=-${{ matrix.target }},value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}
type=semver,enable=${{ matrix.target == 'onbuild' && matrix.composer_version == '2' }},pattern={{major}}.{{minor}},value=${{ matrix.php_version }}.0
# {{major}}-composer{{major}}
type=semver,enable=${{ matrix.target == 'onbuild' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-composer${{ matrix.composer_version }},value=${{ matrix.php_version }}.0
# {{major}}-target
type=semver,enable=${{ matrix.composer_version == '2' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-${{ matrix.target }},value=${{ matrix.php_version }}.0
# {{major}}
type=semver,enable=${{ matrix.target == 'onbuild' && matrix.composer_version == '2' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},value=${{ matrix.php_version }}.0
# extra matrix tags
${{ matrix.extra_tags }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v4
with:
context: .
pull: true
load: true
tags: ${{ env.TEST_TAG }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMPOSER_VERSION=${{ matrix.composer_version }}
PHP_VERSION=${{ matrix.php_version }}
target: ${{ matrix.target }}
cache-from: type=gha
- name: Test nginx config
run: docker run --rm -i "$TEST_TAG" nginx -t
- name: Test php-fpm config
run: docker run --rm -i "$TEST_TAG" php-fpm -tt
- name: Test commands exist
run: docker run --rm -i "$TEST_TAG" which composer install-php-extensions clevyr-build
- name: Build and Push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
platforms: ${{ matrix.platforms }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMPOSER_VERSION=${{ matrix.composer_version }}
PHP_VERSION=${{ matrix.php_version }}
target: ${{ matrix.target }}
cache-to: type=gha,mode=max