feat: add Gitea Docker registry deployment with user provisioning (#142)#149
Open
t0kubetsu wants to merge 3 commits into
Open
feat: add Gitea Docker registry deployment with user provisioning (#142)#149t0kubetsu wants to merge 3 commits into
t0kubetsu wants to merge 3 commits into
Conversation
Deploy a standalone Gitea instance configured as an OCI Docker registry, with automated user/SSH-key provisioning and personal access token generation for docker login. Two-stage build (golang:alpine builder, gitea/gitea:latest runtime) matches the #141 reference pattern.
…149) - Fix make tokens: use docker run against named volume (docker exec fails on stopped container) - Fix term-debug-build: guard against missing debug service - Fix yq: explicitly install mikefarah/yq v4.44.1 via wget - Fix SSH port: SSH_LISTEN_PORT=22 + SSH_PORT advertises correct host-mapped port - Fix silent CLI errors: capture stderr, distinguish already-exists from real failures - Fix make clean: scope to project containers only (no system-wide prune) - Require POSTGRES_PASSWORD to be set explicitly (no weak default)
Author
Code review — fixes appliedFix commit: Critical fixes applied
Open medium/low items (not blocking merge for a lab environment)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #142
GITEA__packages__ENABLED=true)registry-token) for every provisioned user, written to a named volume at/tokens/tokens.txtand retrievable viamake tokensChanges
Dockerfile— two-stage build:golang:alpinebuilder installsyq+jq;gitea/gitea:latestruntime copies tools and provisioning scripts;ENTRYPOINTis/provisioning/init.shcompose.yml— three services:db(postgres:16-alpine),gitea(gitea/gitea:latest withGITEA__packages__ENABLED=true),provisioner(build: .); addsgitea-registry-tokens:/tokensvolume for token outputprovisioning/init.sh— POSIX sh script: waits up to 180 s for Gitea health, idempotency stamp guard, creates admin/regular users via gitea CLI, injects SSH keys via REST API, generates registry tokens via REST API and writes to/tokens/tokens.txtprovisioning/users.yml— declarative user manifest (admins[]+users[]withusername,email,password,ssh_keys[])config/app.ini— reference-only app.ini (NOT mounted; settings applied via env vars).env.example— template for all required env vars with placeholder valuesMakefile— mirrors#141reference pattern; addstokenstarget (docker exec gitea-registry-provisioner cat /tokens/tokens.txt).dockerignore— excludes.env, key/cert files, README from build contextREADME.md— Quick Start, Makefile targets, user declaration, SSH key format, Docker registry usage (login/push/pull), token retrieval, env vars table, troubleshootingDesign Notes
golang:alpine(builder) andgitea/gitea:latest(runtime) — matches the official Gitea Dockerfile pattern and the#141reference implementation exactlyGITEA__packages__ENABLED=trueenv var; no app.ini mount requiredgitea-registry-tokensso tokens persist after the provisioner container exits and are accessible viamake tokens/data/gitea/.provisionedprevents double-provisioning on stack restartjq -nto prevent injection via crafted SSH key strings or usernamesTesting
make build-upcompletes without errorhttp://localhost:3000make tokensoutputs ausername:sha1tokenline for each userdocker login localhost:3000 -u trainee01 -p TOKENsucceedsdocker push localhost:3000/trainee01/myimage:latestsucceedsmake reprovisionexits immediately (idempotency guard)make down && make updoes not re-create users (stamp still present)Related Issues