91 lines
2.5 KiB
YAML
91 lines
2.5 KiB
YAML
name: Build Laravel Container
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "laravel/**"
|
|
- ".github/workflows/laravel.yml"
|
|
|
|
jobs:
|
|
laravel-build:
|
|
name: "Build: Laravel Container"
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
version:
|
|
- "8.0"
|
|
- "8.1"
|
|
- "8.2"
|
|
- "8.3"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: laravel
|
|
|
|
- uses: docker/setup-qemu-action@v3
|
|
|
|
- uses: docker/setup-buildx-action@v2
|
|
|
|
- name: "Setup: Login to Docker Hub"
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: matthewbaggett
|
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
|
|
|
- name: "Setup: Login to GHCR"
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: matthewbaggett
|
|
password: ${{ secrets.GHCR_PASSWORD }}
|
|
|
|
- uses: docker/build-push-action@v3
|
|
name: Build & Push
|
|
with:
|
|
context: laravel
|
|
platforms: ${{ !env.ACT && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
|
|
pull: true
|
|
push: true
|
|
build-args: |
|
|
PHP_VERSION=${{ matrix.version }}
|
|
tags: |
|
|
ghcr.io/benzine-framework/laravel:php-${{ matrix.version }}
|
|
benzine/laravel:php-${{ matrix.version }}
|
|
matthewbaggett/laravel:${{ matrix.version }}
|
|
cache-from: ${{ !env.ACT && 'type=gha' || 'type=local,src=/tmp' }}
|
|
cache-to: ${{ !env.ACT && 'type=gha,mode=max' || 'type=local,dest=/tmp' }}
|
|
build-contexts: |
|
|
php:nginx=docker-image://ghcr.io/benzine-framework/php:nginx-8.2
|
|
|
|
laravel-tag-latest:
|
|
name: "Tag: Laravel Container"
|
|
runs-on: ubuntu-latest
|
|
needs: [laravel-build]
|
|
steps:
|
|
- name: "Setup: Login to Docker Hub"
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: matthewbaggett
|
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
|
|
|
- name: "Setup: Login to GHCR"
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: matthewbaggett
|
|
password: ${{ secrets.GHCR_PASSWORD }}
|
|
|
|
- name: "Retag matthewbaggett/laravel:8.3 to matthewbaggett/laravel:latest"
|
|
if: ${{ !env.ACT }}
|
|
run: |
|
|
docker pull matthewbaggett/laravel:8.3
|
|
docker tag matthewbaggett/laravel:8.3 matthewbaggett/laravel:latest
|
|
docker push matthewbaggett/laravel:latest
|