Allow overriding user and group IDs through environment variables with sensible defaults (1000), providing flexibility for different host system configurations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
85 lines
2.4 KiB
YAML
85 lines
2.4 KiB
YAML
services:
|
|
gitea:
|
|
image: gitea/gitea:latest
|
|
container_name: gitea
|
|
restart: unless-stopped
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_started
|
|
environment:
|
|
- USER_UID=${USER_UID:-1000}
|
|
- USER_GID=${USER_GID:-1000}
|
|
- GITEA__database__DB_TYPE=postgres
|
|
- GITEA__database__HOST=db:5432
|
|
- GITEA__database__DATABASE=${POSTGRES_DATABASE}
|
|
- GITEA__database__USER=${POSTGRES_USER}
|
|
- GITEA__database__PASSWD=${POSTGRES_PASSWORD}
|
|
- GITEA__server__DOMAIN=${GITEA_DOMAIN}
|
|
- GITEA__server__SSH_DOMAIN=${GITEA_SSH_DOMAIN}
|
|
- GITEA__server__ROOT_URL=${GITEA_ROOT_URL}
|
|
- GITEA__service__DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-false}
|
|
- GITEA__service__REQUIRE_SIGNIN_VIEW=${REQUIRE_SIGNIN_VIEW:-false}
|
|
- GITEA__log__MODE=console,file
|
|
- GITEA__log__LEVEL=Info
|
|
- GITEA__log__ROOT_PATH=/data/gitea/log
|
|
- GITEA__cache__ENABLED=true
|
|
- GITEA__cache__ADAPTER=redis
|
|
- GITEA__cache__HOST=redis://redis:6379/0?password=${REDIS_PASSWORD}
|
|
ports:
|
|
- "127.0.0.1:3000:3000"
|
|
- "2223:22"
|
|
volumes:
|
|
- ./data:/data
|
|
- /etc/timezone:/etc/timezone:ro
|
|
- /etc/localtime:/etc/localtime:ro
|
|
networks:
|
|
- gitea
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/api/healthz"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
db:
|
|
image: postgres:15-alpine
|
|
container_name: gitea-db
|
|
restart: unless-stopped
|
|
environment:
|
|
- POSTGRES_DB=${POSTGRES_DATABASE}
|
|
- POSTGRES_USER=${POSTGRES_USER}
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
|
volumes:
|
|
- ./postgres:/var/lib/postgresql/data
|
|
- ./db-config/postgresql.conf:/etc/postgresql/postgresql.conf:ro
|
|
networks:
|
|
- gitea
|
|
healthcheck:
|
|
test:
|
|
["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DATABASE}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
redis:
|
|
image: redis:alpine
|
|
container_name: gitea-redis
|
|
restart: unless-stopped
|
|
networks:
|
|
- gitea
|
|
command: redis-server --requirepass ${REDIS_PASSWORD} --maxmemory 256mb --maxmemory-policy allkeys-lru --appendonly yes
|
|
volumes:
|
|
- ./redis:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
networks:
|
|
gitea:
|
|
driver: bridge
|