A stateless Go service for demonstrating secure container packaging and Helm deployment.
curl -X POST localhost:8080/shorten -d '{"url":"https://example.com"}' -H 'content-type: application/json'
curl -i localhost:8080/r/<id>
curl localhost:8080/health- Go
vet, race detector and unit tests in GitHub Actions; - minimal distroless image and non-root user;
- image publishing to GHCR;
- Helm chart with replicas, probes and requests/limits.
go test -race ./...
go run ./cmd/server
helm lint helm/url-shortener
helm template url-shortener helm/url-shortenerGit -> GitHub Actions (gofmt, vet, -race tests) -> GHCR :<sha> distroless -> Helm release
internal/store/store.go— mutex-guarded, collision-checked link store.cmd/server/main.go— HTTPS-only validation, structured JSON errors.Dockerfile— multi-stage build to distroless with a non-rootUSER.helm/url-shortener/— chart with probes, requests/limits and an image updater-friendlyvalues.yaml.
Distilling an image down to just the runtime (distroless) plus a non-root user removes the largest attack surface without adding a base image. Enforcing https:// at the API and 404-ing on unknown links keeps the shortener honest, while go test -race catches the data races a plain Map would otherwise hide under concurrent redirects.
| Path | Method | Purpose |
|---|---|---|
POST /shorten |
POST | shorten an https:// URL, returns id |
GET /r/{id} |
GET | 302 redirect to the original URL |
GET /health |
GET | liveness |