mirror of
https://github.com/casjaysdevdocker/forgejo
synced 2026-09-24 18:50:09 -04:00
AI.md .gitea/workflows/docker.yaml README.md rootfs/tmp/etc/docker/daemon.json rootfs/tmp/etc/forgejo/app.ini
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
name: gitea
|
||||
|
||||
on: push
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release-gitea:
|
||||
@@ -65,4 +67,3 @@ jobs:
|
||||
tags: |
|
||||
${{ steps.meta.outputs.DOCKER_HUB }}/${{ steps.meta.outputs.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.DATE_TAG }}
|
||||
${{ steps.meta.outputs.DOCKER_HUB }}/${{ steps.meta.outputs.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.DOCKER_TAG }}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ This file defines the standards that procedure enforces.
|
||||
# PART INDEX
|
||||
|
||||
| PART | Title |
|
||||
|------|-------|
|
||||
| ---- | -------------------------------------------------- |
|
||||
| 0 | Critical rules |
|
||||
| 1 | Repository model & structure |
|
||||
| 2 | Template system reference |
|
||||
@@ -39,7 +39,7 @@ This file defines the standards that procedure enforces.
|
||||
## Org mapping
|
||||
|
||||
| System | Org | Example |
|
||||
|--------|-----|---------|
|
||||
| ----------------- | ------------------ | -------------------------------------------- |
|
||||
| GitHub (source) | `casjaysdevdocker` | `https://github.com/casjaysdevdocker/{name}` |
|
||||
| Docker Hub (push) | `casjaysdevdocker` | `casjaysdevdocker/{name}` |
|
||||
|
||||
@@ -125,7 +125,7 @@ The only valid directories at the `rootfs/` root are `root/`, `tmp/`, and `usr/`
|
||||
Anything else is a leftover from old patterns. Migration map:
|
||||
|
||||
| Old rootfs path | Correct rootfs path |
|
||||
|-----------------|---------------------|
|
||||
| ---------------------- | ------------------------------- |
|
||||
| `rootfs/etc/{path}` | `rootfs/tmp/etc/{path}` |
|
||||
| `rootfs/config/{path}` | `rootfs/tmp/etc/{path}` |
|
||||
| `rootfs/data/{path}` | `rootfs/tmp/var/{path}` |
|
||||
@@ -172,7 +172,7 @@ The template name selects the base OS family; for an app repo the resulting pull
|
||||
always the matching `casjaysdev/*` image:
|
||||
|
||||
| Template | Final stage | Init / PID 1 | App pulls FROM |
|
||||
|----------|-------------|--------------|----------------|
|
||||
| -------------------- | ------------------ | ------------ | -------------------------------------------- |
|
||||
| `alpine.template` | `scratch.template` | tini | `casjaysdev/alpine` |
|
||||
| `debian.template` | `scratch.template` | tini | `casjaysdev/debian` |
|
||||
| `ubuntu.template` | `scratch.template` | tini | `casjaysdev/ubuntu` |
|
||||
@@ -187,10 +187,12 @@ stack, or a distro-specific package.
|
||||
## Final-stage templates
|
||||
|
||||
`scratch.template` — all non-GUI templates.
|
||||
|
||||
- `ENTRYPOINT [ "tini", "-p", "SIGTERM","--", "/usr/local/bin/entrypoint.sh" ]`
|
||||
- `STOPSIGNAL SIGRTMIN+3`
|
||||
|
||||
`systemd.template` — `web` and `xorg` (systemd is PID 1; tini is redundant).
|
||||
|
||||
- `ENTRYPOINT [ "/sbin/init" ]`
|
||||
- `STOPSIGNAL SIGRTMIN+3`
|
||||
- No `tini_provider` stage, no `COPY --from=tini_provider` line.
|
||||
@@ -226,13 +228,14 @@ generated `Dockerfile`.
|
||||
Resolved values for a `casjaysdevdocker` repo pushing to Docker Hub:
|
||||
|
||||
| Label | Value |
|
||||
|-------|-------|
|
||||
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `url` | `https://hub.docker.com/r/casjaysdevdocker/{name}` — browsable Hub page; `gen-dockerfile` derives it from the registry host (`docker.io` → `hub.docker.com/r/`) |
|
||||
| `source` | `https://github.com/casjaysdevdocker/{name}` |
|
||||
| `documentation` | `https://github.com/casjaysdevdocker/{name}` |
|
||||
|
||||
Older app repos may still carry `url="https://docker.io/casjaysdevdocker/{name}"` — that
|
||||
is the stale form; regeneration corrects it. Removed labels (never re-add):
|
||||
|
||||
- `org.opencontainers.image.base.name` — belongs on the base image, not this image
|
||||
- `org.opencontainers.image.schema-version` — non-spec; redundant with `version`
|
||||
- Any duplicate `authors` or `source` entries
|
||||
@@ -308,7 +311,7 @@ Usage: gen-dockerfile [options] [dir] [template] [repo-name] [git-repo-url]
|
||||
```
|
||||
|
||||
| Flag | Meaning |
|
||||
|------|---------|
|
||||
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `--update` | Rewrite `.env.scripts` (add/drop vars against the current template) and update ARG/LABEL lines in the `Dockerfile`. Touches no other file. |
|
||||
| `--nogit` | Do not init or commit a git repo — required inside an existing repo. |
|
||||
| `--dir PATH` | Operate on / write output to PATH instead of `$PWD`. |
|
||||
@@ -337,7 +340,7 @@ Usage: gen-script [options] [template] [filename]
|
||||
```
|
||||
|
||||
| Flag / env var | Meaning |
|
||||
|----------------|---------|
|
||||
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `--dir PATH` | Write the generated file to `PATH/filename`. |
|
||||
| `-n` / `--name VALUE` | Service name substituted into the template — fills `REPLACE_SERVICE_NAME` in `other/start-service`, pre-populating `SERVICE_NAME=` without a sed step. |
|
||||
| `GEN_SCRIPT_OVERWRITE="Y"` | Overwrite the output without prompting (default `"A"` = ask). Required when the target exists, even with `GEN_SCRIPT_EDITFILE="N"`. |
|
||||
@@ -358,7 +361,7 @@ repos carry exactly one. It is a pure `KEY="value"` file — no logic.
|
||||
## Variables
|
||||
|
||||
| Variable | Purpose |
|
||||
|----------|---------|
|
||||
| -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `ENV_DOCKERFILE` | Dockerfile to build (`Dockerfile`) |
|
||||
| `ENV_REGISTRY_REPO` | Image name in the registry (`{name}`) |
|
||||
| `ENV_REGISTRY_ORG` | Registry namespace — `casjaysdevdocker` for app repos |
|
||||
@@ -385,7 +388,7 @@ repos carry exactly one. It is a pure `KEY="value"` file — no logic.
|
||||
`gen-dockerfile` calls `__migrate_env_script` on every run, renaming old variables:
|
||||
|
||||
| Old name | Current name |
|
||||
|----------|-------------|
|
||||
| ---------------- | ------------------- |
|
||||
| `ENV_IMAGE_NAME` | `ENV_REGISTRY_REPO` |
|
||||
| `ENV_IMAGE_PUSH` | `ENV_REGISTRY_PUSH` |
|
||||
| `ENV_HUB_BASE` | `ENV_REGISTRY_URL` |
|
||||
@@ -403,7 +406,7 @@ Never use the old names in new files. Retired variables that must not reappear a
|
||||
Run in order inside the build stage:
|
||||
|
||||
| Script | Role |
|
||||
|--------|------|
|
||||
| ---------------- | --------------------------------------------------------------------------- |
|
||||
| `00-init.sh` | Initialize base directory structure and environment |
|
||||
| `01-system.sh` | Repos, locales, timezone, system settings |
|
||||
| `02-packages.sh` | App-specific packages, package managers, language runtimes |
|
||||
@@ -491,7 +494,7 @@ The `start-service` template generates all outer hooks fully implemented — cus
|
||||
the matching `*_local()` stub, which each outer hook calls automatically if defined:
|
||||
|
||||
| Outer hook (do not redefine) | Customise via |
|
||||
|------------------------------|---------------|
|
||||
| ---------------------------- | -------------------------------- |
|
||||
| `__run_precopy` | `__run_precopy_local` |
|
||||
| `__execute_prerun` | `__execute_prerun_local` |
|
||||
| `__run_pre_execute_checks` | `__run_pre_execute_checks_local` |
|
||||
|
||||
@@ -14,7 +14,7 @@ docker run -d \
|
||||
--privileged \
|
||||
--restart always \
|
||||
--tty \
|
||||
--cgroupns private \
|
||||
--cgroupns=private \
|
||||
--hostname git.example.com \
|
||||
--domainname example.com \
|
||||
--network bridge \
|
||||
@@ -55,11 +55,12 @@ services:
|
||||
tty: true
|
||||
restart: always
|
||||
logging: *default-logging
|
||||
cgroupns_mode: private
|
||||
cgroup: private
|
||||
cap_add:
|
||||
- CHOWN
|
||||
- SYS_TIME
|
||||
- SYS_ADMIN
|
||||
- CAP_MKNOD
|
||||
environment:
|
||||
TZ: ${TZ:-America/New_York}
|
||||
CONTAINER_NAME: casjaysdevdocker-forgejo-latest
|
||||
@@ -87,14 +88,14 @@ networks:
|
||||
**General**
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| ---------- | ------------------ | ----------------------------------------------- |
|
||||
| `TZ` | `America/New_York` | Timezone |
|
||||
| `DEBUGGER` | _(empty)_ | Set to `on` to enable shell-level debug tracing |
|
||||
|
||||
**Server / domain**
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| ------------------ | ----------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| `FORGEJO_SERVER` | `hostname -f` | Public FQDN — sets ROOT\_URL, DOMAIN, SSH\_DOMAIN, and all email addresses. **Always set this in production.** |
|
||||
| `FORGEJO_HOSTNAME` | _(empty)_ | Alias for `FORGEJO_SERVER` |
|
||||
| `FULL_DOMAIN_NAME` | _(empty)_ | Fallback FQDN used when neither `FORGEJO_SERVER` nor `FORGEJO_HOSTNAME` is set |
|
||||
@@ -108,7 +109,7 @@ networks:
|
||||
**Users**
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| ------------------------ | --------- | ----------------------------------------------------- |
|
||||
| `FORGEJO_ROOT_USER_NAME` | _(empty)_ | Initial admin account username (created on first run) |
|
||||
| `FORGEJO_ROOT_PASS_WORD` | _(empty)_ | Initial admin account password |
|
||||
| `FORGEJO_USER_NAME` | _(empty)_ | Initial normal user username |
|
||||
@@ -117,7 +118,7 @@ networks:
|
||||
**Mail**
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| ----------------------- | -------------------------------- | ---------------------------------------------------------------- |
|
||||
| `FORGEJO_ADMIN` | `administrator@<FORGEJO_SERVER>` | Admin contact / mailer FROM address |
|
||||
| `FORGEJO_EMAIL_RELAY` | `172.17.0.1` | SMTP relay host |
|
||||
| `FORGEJO_EMAIL_CONFIRM` | `false` | Set to `yes` to require email confirmation and enable the mailer |
|
||||
@@ -125,7 +126,7 @@ networks:
|
||||
**Database**
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| --------------------- | --------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `FORGEJO_SQL_TYPE` | `sqlite3` | Database type (`sqlite3`, `mysql`, `postgres`) |
|
||||
| `FORGEJO_SQL_HOST` | `localhost` | Database host (external DB only) |
|
||||
| `FORGEJO_SQL_DB_HOST` | `$FORGEJO_SQL_HOST` | Alternate database host variable |
|
||||
@@ -137,7 +138,7 @@ networks:
|
||||
**act\_runner**
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| ----------------------------- | ---------------------------- | ------------------------------------------------------------------------------- |
|
||||
| `RUNNERS_START` | `5` | Number of act\_runner instances to register |
|
||||
| `RUNNER_CACHE_PORT` | `44015` | Port for the act\_runner cache server |
|
||||
| `RUNNER_IP_ADDRESS` | container IP | IP address act\_runner registers with Forgejo |
|
||||
@@ -148,7 +149,7 @@ networks:
|
||||
**Runner labels** are set automatically based on the host architecture. All jobs run inside Docker containers — no bare-metal execution.
|
||||
|
||||
| Host arch | Labels registered |
|
||||
|-----------|------------------|
|
||||
| --------- | ----------------------------------------------------------------------------------------------------------------------- |
|
||||
| `x86_64` | `amd64:docker://ubuntu:latest`, `linux:docker://ubuntu:latest`, `linux/amd64:docker://ubuntu:latest`, + language images |
|
||||
| `aarch64` | `arm64:docker://ubuntu:latest`, `linux:docker://ubuntu:latest`, `linux/arm64:docker://ubuntu:latest`, + language images |
|
||||
|
||||
@@ -157,14 +158,14 @@ Language image labels available on both architectures: `node` (14/16/18/20/22/la
|
||||
### Volumes
|
||||
|
||||
| Path | Purpose |
|
||||
|------|---------|
|
||||
| --------- | ---------------------------------------------------------------------------------- |
|
||||
| `/data` | Repositories, SQLite database, LFS objects, attachments, indexes |
|
||||
| `/config` | `app.ini`, SSH host keys, act\_runner config — persisted across container restarts |
|
||||
|
||||
### Ports
|
||||
|
||||
| Port | Protocol | Purpose |
|
||||
|------|----------|---------|
|
||||
| ------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `80` | TCP | Forgejo web UI and API |
|
||||
| `22` (internal) / `7833` (default external) | TCP | Git over SSH — host port 22 is typically taken by sshd; map container port 22 to an available host port and set `SSH_PORT` to match |
|
||||
|
||||
@@ -217,6 +218,7 @@ act_runner register \
|
||||
```
|
||||
|
||||
Label format: `name:type:image` — all jobs run inside Docker containers, never directly on the host.
|
||||
|
||||
- `arm64:docker://ubuntu:latest` — dispatched to this runner, job runs in a native arm64 Ubuntu container
|
||||
- `linux/arm64:docker://ubuntu:latest` — OCI-style label for the same runner
|
||||
- Docker must be installed and running on the host machine
|
||||
|
||||
@@ -5,11 +5,14 @@
|
||||
"experimental": true,
|
||||
"pidfile": "/tmp/docker.pid",
|
||||
"cgroup-parent": "/docker",
|
||||
"storage-driver": "fuse-overlayfs",
|
||||
"storage-driver": "vfs",
|
||||
"insecure-registries": ["localhost"],
|
||||
"features": {
|
||||
"containerd-snapshotter": false
|
||||
},
|
||||
"default-address-pools": [
|
||||
{"base": "172.17.0.0/12", "size": 24},
|
||||
{"base": "192.168.0.0/16", "size": 24},
|
||||
{"base": "10.0.0.0/8", "size": 24}
|
||||
],
|
||||
"insecure-registries": ["localhost"]
|
||||
{ "base": "172.17.0.0/12", "size": 24 },
|
||||
{ "base": "192.168.0.0/16", "size": 24 },
|
||||
{ "base": "10.0.0.0/8", "size": 24 }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ DEFAULT_MAX_BLOB_SIZE = 10485760
|
||||
SKIP_TLS_VERIFY = true
|
||||
ALLOWED_DOMAINS =
|
||||
BLOCKED_DOMAINS =
|
||||
ALLOW_LOCALNETWORKS = false
|
||||
ALLOW_LOCALNETWORKS = true
|
||||
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
[git.config]
|
||||
http.sslVerify = false
|
||||
@@ -380,4 +380,4 @@ ENABLED = false
|
||||
RUN_AT_START = false
|
||||
ENABLE_SUCCESS_NOTICE = true
|
||||
SCHEDULE = @every 168h
|
||||
HTTP_ENDPOINT = https://dl.gitea.com/gitea/version.json
|
||||
DOMAIN_ENDPOINT = release.forgejo.org
|
||||
|
||||
Reference in New Issue
Block a user