take registry, project and image as inputs, optional docker hub push

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 19:13:14 +02:00
co-authored by Claude Opus 5.5
parent e75f481d68
commit 9998d345d7
2 changed files with 86 additions and 19 deletions
+24 -5
View File
@@ -1,6 +1,8 @@
# ci
Reusable Gitea Actions workflows for the apps in the cluster.
Reusable Gitea Actions workflows for the apps in the cluster. Needs Gitea 1.27 or later, which
expands called workflows on the server, so each image builds as its own job, in parallel across
the runners. The repository is public so every repo can call it.
## `image.yaml`
@@ -15,6 +17,8 @@ Builds and pushes one or more images with a uniform tag set from
The tag set is computed once per run, so every image of a multi-image repo gets the same tags.
If the `dockerhub-username` and `dockerhub-token` secrets are passed, every image is also pushed with the same tags to `docker.io/<dockerhub-username>/<image>`, e.g. `registry.traberph.de/public/homepage` → `docker.io/traberph/homepage`. Only pass them for public images: Docker Hub creates new repositories as public by default.
```yaml
jobs:
test: ...
@@ -22,21 +26,36 @@ jobs:
needs: test
uses: traberph/ci/.gitea/workflows/image.yaml@main
with:
images: '[{"image": "registry.traberph.de/private/cv"}]'
project: public
image: homepage
push: ${{ github.event_name != 'pull_request' }}
secrets:
registry-username: ${{ secrets.REGISTRY_USERNAME }}
registry-token: ${{ secrets.REGISTRY_TOKEN }}
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} # optional
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} # optional
```
Inputs:
- `images` (required): JSON array of `{"image", "context", "dockerfile"}`; `context` defaults to `.`, `dockerfile` to `<context>/Dockerfile`.
- `registry`: registry to log in to (default `registry.traberph.de`).
- `registry`: default `registry.traberph.de`.
- `project` (required): Harbor project, e.g. `public` or `private`.
- `image`: image name, used in Harbor (`<registry>/<project>/<image>`) and on Docker Hub.
- `context`: default `.`.
- `dockerfile`: default `<context>/Dockerfile`.
- `images`: several images instead of `image`/`context`/`dockerfile`, as a JSON array of `{"image", "context", "dockerfile"}`:
```yaml
project: uni-spam
images: |
[
{"image": "inference", "context": "services/inference"},
{"image": "webapp", "context": "services/webapp/frontend"}
]
```
- `platforms`: default `linux/amd64,linux/arm64`. QEMU is set up when an `arm` platform is listed.
- `build-args`: newline-separated `KEY=value`, passed to every image.
- `push`: default `true`.
- `cache`: keep the layer cache in the registry as `<image>:buildcache` (default `false`).
- `cache`: keep the layer cache in Harbor as `<image>:buildcache` (default `false`).
Outputs: `tag` (the timestamp tag), `version`, `tag-names`.