build image with shared traberph/ci workflow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 19:18:44 +02:00
co-authored by Claude Opus 5.5
parent 810eebf09d
commit bf06e79bbe
2 changed files with 22 additions and 44 deletions
+13 -38
View File
@@ -7,42 +7,17 @@ on:
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
env:
REGISTRY: registry.traberph.de
IMAGE: registry.traberph.de/public/interval_viz
jobs: jobs:
build: # Tags and build steps are shared across repos, see traberph/ci.
runs-on: ubuntu-latest image:
steps: uses: traberph/ci/.gitea/workflows/image.yaml@main
- uses: actions/checkout@v4 with:
project: public
- uses: docker/setup-buildx-action@v3 image: interval_viz
push: ${{ github.event_name != 'pull_request' }}
- name: Log in to registry secrets:
if: github.event_name != 'pull_request' registry-username: ${{ secrets.REGISTRY_USERNAME }}
uses: docker/login-action@v3 registry-token: ${{ secrets.REGISTRY_TOKEN }}
with: # Public image; also pushed to Docker Hub once these secrets exist.
registry: ${{ env.REGISTRY }} dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ secrets.REGISTRY_USERNAME }} dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Image tags
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
# main-<sha>-<unix time> sorts by build time, for Flux image automation
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=main-{{sha}}-{{date 'X'}},enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+9 -6
View File
@@ -92,19 +92,22 @@ credentials are set in `docker-compose.yml`. The host port can be changed with
## CI: build and push ## CI: build and push
`.gitea/workflows/docker.yml` builds the image with Gitea Actions and pushes it `.gitea/workflows/docker.yml` builds the image (`linux/amd64`, `linux/arm64`) with the
shared [`traberph/ci`](https://git.traberph.de/traberph/ci) image workflow and pushes it
to the Harbor registry as `registry.traberph.de/public/interval_viz`. to the Harbor registry as `registry.traberph.de/public/interval_viz`.
| Trigger | Tags pushed | | Trigger | Tags pushed |
|--------------------|------------------------------------------------------| |--------------------|------------------------------------------------------|
| push to `main` | `latest`, `main-<sha>-<unix time>` (e.g. `main-6cecbcf-1790415657`) | | push to `main` | `latest`, `<UTC yyyymmddHHMMSS>-<sha7>` (e.g. `20261016171500-6cecbcf`) |
| tag `v1.2.3` | `1.2.3`, `1.2` | | tag `v1.2.3` | `1.2.3`, `1.2`, `1`, `<UTC yyyymmddHHMMSS>-<sha7>` |
| pull request | build only, nothing pushed | | pull request | build only, nothing pushed |
| manual dispatch | as for the selected ref | | manual dispatch | as for the selected ref |
The `main-…` tags sort by build time via the trailing timestamp. Flux image The timestamp tags sort by build time. Flux image automation picks the newest one with
automation can pick the newest one with this filter: this filter: `pattern: '^(?P<ts>[0-9]{14})-[a-f0-9]{7}$'`, `extract: '$ts'`, `numerical: asc`.
`pattern: '^main-[a-f0-9]+-(?P<ts>[0-9]+)$'`, `extract: '$ts'`, `numerical: asc`.
With the `DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN` secrets set, the same tags are also
pushed to `docker.io/<DOCKERHUB_USERNAME>/interval_viz`.
Old tags are cleaned up by a tag retention policy in Harbor, not by this workflow. Old tags are cleaned up by a tag retention policy in Harbor, not by this workflow.