ci: add make check, Gitea workflow, numeric runtime user
ci / check (push) Successful in 1m32s
ci / check (pull_request) Successful in 57s

This commit is contained in:
Noel Sabia committed 2026-11-14 05:11:31 +01:00
1 parent 9ebb9cdf0d
commit 539b90cf4e
4 files changed
+69 -1

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
name: ci
on:
push:
pull_request:
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Check
run: make check
+3 -1
View File
@@ -24,6 +24,8 @@ ENV DATA_DIR=/app/data \
PORT=8080 PORT=8080
EXPOSE 8080 EXPOSE 8080
USER nonroot:nonroot # Numeric UID/GID: the kubelet cannot verify named users for runAsNonRoot.
# 65532 is the distroless "nonroot" user.
USER 65532:65532
ENTRYPOINT ["/app/api"] ENTRYPOINT ["/app/api"]
+15
View File
@@ -0,0 +1,15 @@
GO ?= go
.PHONY: check vet test build
# Local equivalent of the Gitea Actions CI job.
check: vet test build
vet:
$(GO) vet ./...
test:
$(GO) test -count=1 ./...
build:
$(GO) build ./...
+28
View File
@@ -1,3 +1,31 @@
# api-go # api-go
Golang API that is the backbone for daily usage, while python works in batches and is heavy in compute while Golang handles concurrent usage cheap Golang API that is the backbone for daily usage, while python works in batches and is heavy in compute while Golang handles concurrent usage cheap
## Checks
```sh
make check
```
Runs `go vet ./...`, `go test -count=1 ./...`, and `go build ./...`. The same
target runs in Gitea Actions on every push and pull request
(`.gitea/workflows/ci.yml`).
## Container
The image is a multi-stage build. The runtime is
`gcr.io/distroless/static-debian12:nonroot` and runs as numeric
**UID/GID `65532:65532`** (`USER 65532:65532` in the `Dockerfile`).
Use the same numbers in Kubernetes:
```yaml
securityContext:
runAsUser: 65532
runAsGroup: 65532
runAsNonRoot: true
```
Do not use named users such as `nonroot` in a `securityContext`: the kubelet
cannot verify a non-numeric image user.