gitea actions
Container / test (push) Successful in 38s
Container / docker (push) Failing after 37s

This commit is contained in:
nick committed 2026-09-18 20:08:29 -07:00
1 parent 71c11457cd
commit 7967dbf9f0
4 files changed
+145 -1

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
# Gitea Actions and Container Registry
The workflow in [`.gitea/workflows/container.yml`](../.gitea/workflows/container.yml) runs tests, builds the Docker image, and publishes it to this Gitea instance’s OCI registry.
## What it publishes
On `main`, version tags (`v*`), and manual **Run workflow**:
```
git.atlashorizon.net/nick/cert-portal:latest # default branch only
git.atlashorizon.net/nick/cert-portal:main
git.atlashorizon.net/nick/cert-portal:sha-<short-sha>
git.atlashorizon.net/nick/cert-portal:v1.2.3 # git tags named v*
```
The host is taken from the Actions server URL (or `vars.REGISTRY` if you set one). The image name is `{registry}/{owner}/{repo}` in lowercase, which is what [Gitea’s container registry](https://docs.gitea.com/usage/packages/container) requires.
Pull requests **build** the image but do **not** push.
## One-time Gitea setup
1. Enable **Actions** on the repository (`Settings` → `Actions`).
2. Enable **Packages** for the owner (user or org) if it is not already on.
3. Register an **act_runner** that can build images: Docker socket or privileged `dind`. A label matching `runs-on: ubuntu-latest` (Gitea’s default runner label) is enough.
4. If `actions/checkout@v4` and the Docker actions cannot be fetched, either set Gitea `[actions].DEFAULT_ACTIONS_URL = github` or mirror those actions onto this instance and change the `uses:` lines.
### Registry login from the job
The workflow logs in as the user who triggered the job (`github.actor`) with `secrets.GITEA_TOKEN` (the job token). Give that token **package write** if your instance uses restricted token permissions (`Settings` → `Actions` → `General`, and `permissions: packages: write` in the workflow).
If login returns **401**, the job token cannot write packages on this Gitea version. Create a PAT with **package read/write** (and 2FA/OAuth accounts must use a token, not a password) and add repository secrets:
| Secret | Purpose |
| --- | --- |
| `REGISTRY_TOKEN` | PAT used instead of `GITEA_TOKEN` |
| `REGISTRY_USERNAME` | Optional; defaults to the triggering user |
Optional instance setting:
| Variable | Purpose |
| --- | --- |
| `REGISTRY` | Registry host if it is not the Gitea web hostname |
After the first successful push, open **Packages** on the user/org (or the repo if Gitea linked the package). Pull:
```bash
docker login git.atlashorizon.net
docker pull git.atlashorizon.net/nick/cert-portal:latest
```
Run it the same way as a local build; see [setup.md](setup.md).
## Manual run
**Actions** → **Container** → **Run workflow**. That tags the image `manual` in addition to the SHA tag.
+10
View File
@@ -89,6 +89,16 @@ docker run --rm -p 8000:8000 --env-file .env \
The image runs as UID 1000. The signing P12 path inside the container must match `PROFILE_SIGNING_P12_PATH`.
CI on this Gitea publishes `git.atlashorizon.net/nick/cert-portal` (see [gitea.md](gitea.md)):
```bash
docker login git.atlashorizon.net
docker pull git.atlashorizon.net/nick/cert-portal:latest
docker run --rm -p 8000:8000 --env-file .env \
-v /etc/cert-portal:/etc/cert-portal:ro \
git.atlashorizon.net/nick/cert-portal:latest
```
## 8. OpenAPI
`/docs`, `/redoc`, and `/openapi.json` are **off** when `ENVIRONMENT=production` unless you set `DOCS_ENABLED=true`. They are on in `development`. Do not expose Swagger to the internet without additional access control.