From a79ffa1f6ab4c6654627427ebf41f75f148a8fd1 Mon Sep 17 00:00:00 2001 From: casjay Date: Sat, 29 Nov 2025 13:12:37 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Update=20codebase=20?= =?UTF-8?q?=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit README.md rootfs/tmp/etc/gitea/app.ini rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/etc/docker/init.d/05-dockerd.sh rootfs/usr/local/etc/docker/init.d/08-gitea.sh --- README.md | 72 ++++++++++++++++--- rootfs/tmp/etc/gitea/app.ini | 14 +++- rootfs/usr/local/bin/entrypoint.sh | 7 ++ .../usr/local/etc/docker/init.d/05-dockerd.sh | 8 +++ .../usr/local/etc/docker/init.d/08-gitea.sh | 4 +- 5 files changed, 91 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index ebff78f..fff4489 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,34 @@ -## 👋 Welcome to gitea 🚀 +## 👋 Welcome to gitea 🚀 + +Self-hosted Git service with built-in CI/CD (Gitea Actions), Docker-in-Docker support, and SSH access. + +## Features + +- 🚀 **Latest Gitea** - Auto-downloads latest version on build +- 🐳 **Docker-in-Docker** - Run Docker inside the container for CI/CD +- ⚙️ **Gitea Actions** - Built-in CI/CD with act_runner (5 parallel runners by default) +- 🔐 **SSH Server** - Git operations over SSH (port 22/7833) +- 📦 **Package Registry** - Container, NPM, Maven, PyPI, and more +- 💾 **SQLite** - Zero-config database (PostgreSQL/MySQL supported) +- 🔧 **Easy Configuration** - Environment variable driven setup + +## Quick Start + +### Simple Run (HTTP only) + +```bash +docker run -d \ + --privileged \ + --name gitea \ + -p 80:80 \ + -p 22:22 \ + -v "$HOME/.local/share/srv/docker/casjaysdevdocker-gitea/rootfs/data:/data:z" \ + -v "$HOME/.local/share/srv/docker/casjaysdevdocker-gitea/rootfs/config:/config:z" \ + casjaysdevdocker/gitea:latest +``` + +Access Gitea at: `http://localhost` -Description - - ## Install my system scripts ```shell @@ -34,8 +60,34 @@ docker run -d \ casjaysdevdocker/gitea:latest ``` -## via docker-compose - +## Environment Variables + +| Variable | Default | Description | +|----------|---------|-------------| +| `GITEA_EMAIL_CONFIRM` | `false` | Enable email notifications | +| `EMAIL_RELAY` | `172.17.0.1` | SMTP relay (Docker host gateway) | +| `SERVER_ADMIN` | `administrator@$HOSTNAME` | Admin email address | +| `RUNNERS_START` | `5` | Number of parallel CI/CD runners | +| `GITEA_HOSTNAME` | `$HOSTNAME` | Gitea server hostname | +| `TZ` | `America/New_York` | Timezone | + +### Enable Email Notifications + +```bash +docker run -d \ + --privileged \ + --name gitea \ + -e GITEA_EMAIL_CONFIRM=yes \ + -e EMAIL_RELAY=smtp.gmail.com \ + -e SERVER_ADMIN=admin@example.com \ + -p 80:80 -p 22:22 \ + -v "$HOME/.local/share/srv/docker/casjaysdevdocker-gitea/rootfs/data:/data:z" \ + -v "$HOME/.local/share/srv/docker/casjaysdevdocker-gitea/rootfs/config:/config:z" \ + casjaysdevdocker/gitea:latest +``` + +## via docker-compose + ```yaml version: "2" services: @@ -65,13 +117,13 @@ OR git clone "https://github.com/casjaysdevdocker/gitea" "$HOME/Projects/github/casjaysdevdocker/gitea" ``` -## Build container - +## Build container + ```shell cd "$HOME/Projects/github/casjaysdevdocker/gitea" -buildx +buildx ``` - + ## Authors 🤖 casjay: [Github](https://github.com/casjay) 🤖 diff --git a/rootfs/tmp/etc/gitea/app.ini b/rootfs/tmp/etc/gitea/app.ini index 9f8a9f4..889b2ed 100644 --- a/rootfs/tmp/etc/gitea/app.ini +++ b/rootfs/tmp/etc/gitea/app.ini @@ -166,6 +166,9 @@ ENDLESS_TASK_TIMEOUT = 3h ABANDONED_JOB_TIMEOUT = 24h SKIP_WORKFLOW_STRINGS = [skip ci],[ci skip],[no ci],[skip actions],[actions skip] ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +[actions.artifacts] +ENABLED = true +; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [storage.actions_log] STORAGE_TYPE = local ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -174,9 +177,16 @@ ENABLED = REPLACE_GITEA_EMAIL SMTP_ADDR = REPLACE_EMAIL_RELAY SMTP_PORT = 25 FROM = REPLACE_SERVER_ADMIN -USER = -PASSWD = +USER = +PASSWD = PROTOCOL = +SEND_AS_PLAIN_TEXT = false +; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +[email.incoming] +ENABLED = false +; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +[notify.email] +ENABLED = REPLACE_GITEA_EMAIL_CONFIRM ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [openid] ENABLE_OPENID_SIGNIN = true diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 9ea46cf..1c386d9 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -223,6 +223,13 @@ mkdir -p "/usr/local/etc/docker/exec" touch "/data/logs/start.log" touch "/data/logs/entrypoint.log" # - - - - - - - - - - - - - - - - - - - - - - - - - +# Enable cgroup v2 delegation for Docker-in-Docker +if [ -f "/sys/fs/cgroup/cgroup.controllers" ]; then + if [ -w "/sys/fs/cgroup/cgroup.subtree_control" ]; then + cat /sys/fs/cgroup/cgroup.controllers > /sys/fs/cgroup/cgroup.subtree_control 2>/dev/null || true + fi +fi +# - - - - - - - - - - - - - - - - - - - - - - - - - # fix permissions chmod -f 777 "/run" chmod -f 777 "/tmp" diff --git a/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh b/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh index 4481226..a152692 100755 --- a/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh +++ b/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh @@ -227,6 +227,14 @@ __run_pre_execute_checks() { __banner "$pre_execute_checks_MessageST" # Put command to execute in parentheses { + # Fix cgroup v2 delegation for Docker-in-Docker + if [ -f "/sys/fs/cgroup/cgroup.controllers" ]; then + echo "Enabling cgroup v2 delegation for Docker-in-Docker" + # Enable all available controllers at root + if [ -w "/sys/fs/cgroup/cgroup.subtree_control" ]; then + cat /sys/fs/cgroup/cgroup.controllers > /sys/fs/cgroup/cgroup.subtree_control 2>/dev/null || true + fi + fi [ -L "/config/docker/daemon.json" ] && unlink "/config/docker/daemon.json" if [ -n "$DOCKER_REGISTRIES" ]; then local set_reg="" diff --git a/rootfs/usr/local/etc/docker/init.d/08-gitea.sh b/rootfs/usr/local/etc/docker/init.d/08-gitea.sh index 8548ef7..b6af02d 100755 --- a/rootfs/usr/local/etc/docker/init.d/08-gitea.sh +++ b/rootfs/usr/local/etc/docker/init.d/08-gitea.sh @@ -182,9 +182,9 @@ GITEA_SQL_HOST="${GITEA_SQL_HOST:-localhost}" GITEA_WORK_DIR="${GITEA_WORK_DIR:-$WORK_DIR}" TZ="${GITEA_TZ:-${TZ:-America/New_York}}" SERVICE_PROTOCOL="${GITEA_PROTO:-$SERVICE_PROTOCOL}" -EMAIL_RELAY="${GITEA_EMAIL_RELAY:-${EMAIL_RELAY:-localhost}}" +EMAIL_RELAY="${GITEA_EMAIL_RELAY:-${EMAIL_RELAY:-172.17.0.1}}" SERVER_SITE_TITLE="${GITEA_NAME:-${SERVER_SITE_TITLE:-SelfHosted GIT Server}}" -SERVER_ADMIN="${GITEA_ADMIN:-${SERVER_ADMIN:-gitea@${DOMAINNAME:-$GITEA_HOSTNAME}}}" +SERVER_ADMIN="${GITEA_ADMIN:-${SERVER_ADMIN:-administrator@${HOSTNAME}}}" GITEA_SERVER="${ENV_GITEA_SERVER:-$GITEA_SERVER}" GITEA_EMAIL_CONFIRM="${GITEA_EMAIL_CONFIRM:-false}" GITEA_SQL_DB_HOST="${GITEA_SQL_DB_HOST:-localhost}"