feat: ci #2

Merged
Noel merged 3 commits from feat/ci into main 2026-11-14 04:43:42 +00:00
4 changed files with 69 additions and 1 deletions

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
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"]
+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
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.