#!/usr/bin/env sh set -eu mkdir -p /data/gitea/conf /data/gitea/custom /data/custom /data/caddy # Bootstrap Gitea if [ ! -f /data/.bootstrapped ]; then /usr/local/bin/gitea migrate /usr/local/bin/gitea admin user create --admin \ --username "${GITEA_ADMIN_USER}" \ --password "${GITEA_ADMIN_PASSWD}" \ --email "${GITEA_ADMIN_EMAIL}" || true touch /data/.bootstrapped fi # Pull Gitea customizations if [ -n "${CUSTOM_REPO_URL:-}" ]; then if [ ! -d /data/custom/.git ]; then git clone --depth 1 "${CUSTOM_REPO_URL}" /data/custom || true else git -C /data/custom pull --ff-only || true fi rsync -a --delete /data/custom/ /data/gitea/custom/ fi # Pull Caddy config if [ -n "${CADDY_REPO_URL:-}" ]; then if [ ! -d /data/caddyrepo/.git ]; then git clone --depth 1 "${CADDY_REPO_URL}" /data/caddyrepo || true else git -C /data/caddyrepo pull --ff-only || true fi if [ -f "/data/caddyrepo/Caddyfile" ]; then cp "/data/caddyrepo/Caddyfile" /data/caddy/Caddyfile fi fi