48 lines
1.6 KiB
YAML
48 lines
1.6 KiB
YAML
name: "Build: Docker"
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
PLATFORMS: linux/amd64,linux/arm64
|
|
CANDIDATE_IMAGE: ghcr.io/benzine-framework/bouncer:build-${{ github.sha }}
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Swarm Loadbalancer
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: benzine-framework/action-setup-php@main
|
|
- uses: benzine-framework/action-setup-docker@main
|
|
with:
|
|
ghcr_user: ${{ github.repository_owner }}
|
|
ghcr_token: ${{ secrets.GHCR_TOKEN }}
|
|
docker_hub_user: ${{ secrets.DOCKER_HUB_USER }}
|
|
docker_hub_token: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
- name: "Build & Push Candidate Image as ${{ env.CANDIDATE_IMAGE }}"
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
target: bouncer
|
|
build-contexts: |
|
|
php:cli=docker-image://ghcr.io/benzine-framework/php:cli-${{ steps.read-php-version.outputs.php_version }}
|
|
build-args: |
|
|
GIT_SHA=${{ github.sha }}
|
|
GIT_BUILD_ID=${{ github.ref_name }}
|
|
GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }}
|
|
BUILD_DATE=${{ steps.date.outputs.container_build_datetime }}
|
|
platforms: ${{ !env.ACT && env.PLATFORMS || 'linux/amd64' }}
|
|
pull: true
|
|
push: true
|
|
tags: ${{ env.CANDIDATE_IMAGE }}
|
|
cache-from: ${{ !env.ACT && 'type=gha' || '' }}
|
|
cache-to: ${{ !env.ACT && 'type=gha,mode=max' || '' }}
|