mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-20 00:33:45 +01:00
* Initial plan * Use ARM runners for ARM Docker image builds Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> * Fix artifact naming and add comments for latest=false flavor Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> * Remove trailing commas from tag configuration in merge job Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> * Remove duplicate tag entries and clean up configuration Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
162 lines
4.9 KiB
YAML
162 lines
4.9 KiB
YAML
name: Docker Image Build (FrankenPHP)
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
#schedule:
|
|
# - cron: '0 10 * * *' # everyday at 10am
|
|
push:
|
|
branches:
|
|
- '**'
|
|
- '!l10n_**'
|
|
tags:
|
|
- 'v*.*.*'
|
|
- 'v*.*.*-**'
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- platform: linux/amd64
|
|
runner: ubuntu-latest
|
|
platform-slug: amd64
|
|
- platform: linux/arm64
|
|
runner: ubuntu-24.04-arm
|
|
platform-slug: arm64
|
|
- platform: linux/arm/v7
|
|
runner: ubuntu-24.04-arm
|
|
platform-slug: armv7
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v6
|
|
-
|
|
name: Docker meta
|
|
id: docker_meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
# list of Docker images to use as base name for tags
|
|
images: |
|
|
partdborg/part-db
|
|
# Mark the image build from master as latest (as we dont have really releases yet)
|
|
tags: |
|
|
type=edge,branch=master
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=schedule
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=ref,event=pr
|
|
labels: |
|
|
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
|
org.opencontainers.image.title=Part-DB
|
|
org.opencontainers.image.description=Part-DB is a web application for managing electronic components and your inventory.
|
|
org.opencontainers.image.url=https://github.com/Part-DB/Part-DB-server
|
|
org.opencontainers.image.source=https://github.com/Part-DB/Part-DB-server
|
|
org.opencontainers.image.authors=Jan Böhmer
|
|
org.opencontainers.licenses=AGPL-3.0-or-later
|
|
# Disable automatic 'latest' tag in build jobs - it will be created in merge job
|
|
flavor: |
|
|
latest=false
|
|
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
-
|
|
name: Login to DockerHub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
-
|
|
name: Build and push by digest
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Dockerfile-frankenphp
|
|
platforms: ${{ matrix.platform }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
outputs: type=image,name=partdborg/part-db,push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
|
|
cache-from: type=gha,scope=build-${{ matrix.platform }}
|
|
cache-to: type=gha,mode=max,scope=build-${{ matrix.platform }}
|
|
|
|
-
|
|
name: Export digest
|
|
if: github.event_name != 'pull_request'
|
|
run: |
|
|
mkdir -p /tmp/digests
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
touch "/tmp/digests/${digest#sha256:}"
|
|
|
|
-
|
|
name: Upload digest
|
|
if: github.event_name != 'pull_request'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: digests-${{ matrix.platform-slug }}
|
|
path: /tmp/digests/*
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
merge:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build
|
|
if: github.event_name != 'pull_request'
|
|
steps:
|
|
-
|
|
name: Download digests
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: /tmp/digests
|
|
pattern: digests-*
|
|
merge-multiple: true
|
|
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
-
|
|
name: Docker meta
|
|
id: docker_meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
partdborg/part-db
|
|
tags: |
|
|
type=edge,branch=master
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=schedule
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=ref,event=pr
|
|
|
|
-
|
|
name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
-
|
|
name: Create manifest list and push
|
|
working-directory: /tmp/digests
|
|
run: |
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
$(printf 'partdborg/part-db@sha256:%s ' *)
|
|
|
|
-
|
|
name: Inspect image
|
|
run: |
|
|
docker buildx imagetools inspect partdborg/part-db:${{ steps.docker_meta.outputs.version }}
|