82 lines
2.3 KiB
YAML
82 lines
2.3 KiB
YAML
name: Build Swarm Monitor
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
swarm-monitor-build:
|
|
name: Build Swarm Monitor
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
component:
|
|
- agent
|
|
- stats
|
|
steps:
|
|
- name: "Setup: PHP"
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: 8.1
|
|
env:
|
|
runner: self-hosted
|
|
|
|
- name: "Setup: Setup QEMU"
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: "Setup: Expose GitHub Runtime"
|
|
uses: crazy-max/ghaction-github-runtime@v3
|
|
|
|
- name: "Setup: Setup Docker Buildx"
|
|
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 }}
|
|
|
|
- name: "Setup: Checkout Source"
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
swarm-monitor
|
|
|
|
- name: "Setup: Configure Cache"
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: swarm-monitor
|
|
key: ${{ runner.os }}-swarm-monitor-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-swarm-monitor-composer-
|
|
|
|
- name: "Dependencies: Composer Install"
|
|
working-directory: swarm-monitor
|
|
run: composer install --ignore-platform-reqs
|
|
|
|
- name: "Build: Build & Push Image"
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: swarm-monitor
|
|
target: swarm-${{ matrix.component }}
|
|
platforms: ${{ !env.ACT && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
|
|
pull: true
|
|
push: true
|
|
tags: |
|
|
matthewbaggett/swarm-agent:${{ matrix.component }}
|
|
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:cli=docker-image://ghcr.io/benzine-framework/php:cli-8.2
|