Files
macos-tools/gitea/docker-compose.yml

123 lines
4.1 KiB
YAML

services:
gitea:
image: docker.m.daocloud.io/gitea/gitea:1.21
container_name: gitea3
restart: unless-stopped
ports:
- "33000:3000"
- "32222:32222"
volumes:
# 使用 Docker 命名卷持久化
- gitea-data:/data
# 时区同步
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=sqlite3
- GITEA__database__PATH=/data/gitea/gitea.db
- GITEA__server__DOMAIN=${GITEA_DOMAIN:-192.168.1.83}
- GITEA__server__SSH_DOMAIN=${GITEA_SSH_DOMAIN:-192.168.1.83}
- GITEA__server__ROOT_URL=http://${GITEA_DOMAIN:-192.168.1.83}:33000/
- GITEA__server__DISABLE_SSH=false
- GITEA__server__SSH_PORT=32222
- GITEA__server__SSH_LISTEN_PORT=32222
- GITEA__server__START_SSH_SERVER=true
- GITEA__server__LFS_START_SERVER=true
- GITEA__server__BUILTIN_SSH_SERVER_USER=git
- GITEA__repository__ENABLE_PUSH_CREATE_USER=true
- GITEA__repository__ENABLE_PUSH_CREATE_ORG=true
- GITEA__webhook__ALLOWED_HOST_LIST=localhost,jenkins,${GITEA_DOMAIN:-192.168.1.83}
- GITEA__service__DISABLE_REGISTRATION=false # 允许注册
- GITEA__service__REQUIRE_SIGNIN_VIEW=false
- GITEA__actions__ENABLED=true # 启用Actions
- GITEA__actions__DEFAULT_ACTIONS_URL=https://github.com
# 禁用代理,确保健康检查和内部通信不受影响
- http_proxy=
- https_proxy=
- HTTP_PROXY=
- HTTPS_PROXY=
- NO_PROXY=localhost,127.0.0.1,*.local,192.168.*,10.*,172.16.*
networks:
- core
- gitea-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/healthz"]
interval: 30s
timeout: 10s
retries: 3
# ==========================================
# Gitea Action Runner 1 - Docker 构建
# ==========================================
runner-docker:
image: docker.m.daocloud.io/gitea/act_runner:latest
container_name: gitea-runner-docker
restart: unless-stopped
depends_on:
gitea:
condition: service_healthy
environment:
- CONFIG_FILE=/config/runner-config.yaml
- GITEA_INSTANCE_URL=http://192.168.1.83:33000
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN:-}
- GITEA_RUNNER_NAME=runner-docker-01
- GITEA_RUNNER_LABELS=docker:docker://ghcr.io/go-gitea/act_runner/act_runner:latest
volumes:
- /Users/brunogao/.orbstack/run/docker.sock:/var/run/docker.sock
- ./runner-docker:/data
- ./runner-config.yaml:/config/runner-config.yaml:ro
networks:
- gitea-network
healthcheck:
test: ["CMD", "wget", "-q", "-O-", "http://gitea:3000/api/healthz"]
interval: 30s
timeout: 10s
retries: 3
# ==========================================
# Gitea Action Runner 2 - Kubernetes 部署
# ==========================================
runner-k8s:
image: docker.m.daocloud.io/gitea/act_runner:latest
container_name: gitea-runner-k8s
restart: unless-stopped
privileged: true
depends_on:
gitea:
condition: service_healthy
environment:
- CONFIG_FILE=/config/runner-k8s-config.yaml
- GITEA_INSTANCE_URL=http://192.168.1.83:33000
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN:-}
- GITEA_RUNNER_NAME=runner-k8s-01
- GITEA_RUNNER_LABELS=kubernetes:docker://ghcr.io/go-gitea/act_runner/act_runner:latest
volumes:
- /Users/brunogao/.orbstack/run/docker.sock:/var/run/docker.sock
- $HOME/.kube/config:/root/.kube/config:ro
- ./runner-k8s:/data
- ./runner-k8s-config.yaml:/config/runner-k8s-config.yaml:ro
entrypoint: ["/bin/sh", "-c"]
command:
- |
apk add --no-cache docker-cli kubectl
exec /sbin/tini -- run.sh
networks:
- gitea-network
healthcheck:
test: ["CMD", "wget", "-q", "-O-", "http://gitea:3000/api/healthz"]
interval: 30s
timeout: 10s
retries: 3
networks:
core:
external: true
gitea-network:
driver: bridge
volumes:
gitea-data:
driver: local