45 lines
1.6 KiB
YAML
45 lines
1.6 KiB
YAML
name: "Build: Docker"
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
PLATFORMS: ${{ vars.PLATFORMS }}
|
|
DOCKER_IMAGE: ghcr.io/${{ github.repository }}
|
|
|
|
jobs:
|
|
docker-build:
|
|
name: Build Swarm Load Balancer
|
|
runs-on: ${{ vars.RUNS_ON || 'ubuntu-latest' }}
|
|
steps:
|
|
- uses: benzine-framework/action-setup-php@main
|
|
- uses: benzine-framework/action-get-datetime@main
|
|
- uses: benzine-framework/action-setup-docker@main
|
|
with:
|
|
ghcr_user: ${{ vars.SERVICE_ACCOUNT_USERNAME }}
|
|
ghcr_token: ${{ secrets.SERVICE_ACCOUNT_TOKEN }}
|
|
- name: "Build & Push Candidate Image as ${{ env.CANDIDATE_IMAGE }}"
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
target: loadbalancer
|
|
build-args: |
|
|
MAINTAINER=${{ vars.PUBLIC_MAINTAINER || 'Matthew Baggett <matthew@baggett.me>' }}
|
|
SOURCE_URL="https://github.com/${{ github.repository }}"
|
|
GIT_SHA=${{ github.sha }}
|
|
GIT_BUILD_ID=${{ github.ref_name }}
|
|
GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }}
|
|
BUILD_DATE=${{ env.ATOM }}
|
|
platforms: ${{ github.actor != 'nektos/act' && vars.PLATFORMS || 'linux/amd64' }}
|
|
pull: true
|
|
push: ${{ github.ref == 'refs/heads/main' }}
|
|
tags: |
|
|
${{ env.DOCKER_IMAGE }}:date-${{ env.DATE }}
|
|
${{ env.DOCKER_IMAGE }}:sha-${{ github.sha }}
|
|
cache-from: ${{ env.DOCKER_CACHE_FROM }}
|
|
cache-to: ${{ env.DOCKER_CACHE_TO }}
|