Files
compose-anything/src/gitea/docker-compose.yaml
2025-11-03 20:16:08 +08:00

73 lines
1.8 KiB
YAML

x-defaults: &defaults
restart: unless-stopped
logging:
driver: json-file
options:
max-size: 100m
max-file: "3"
services:
gitea:
<<: *defaults
image: gitea/gitea:${GITEA_VERSION:-1.24.6-rootless}
environment:
- USER_UID=1000
- USER_GID=1000
- TZ=${TZ:-UTC}
- GITEA__database__DB_TYPE=${GITEA_DB_TYPE:-postgres}
- GITEA__database__HOST=${GITEA_POSTGRES_HOST:-db:5432}
- GITEA__database__USER=${POSTGRES_USER:-gitea}
- GITEA__database__NAME=${POSTGRES_DB:-gitea}
- GITEA__database__PASSWD=${POSTGRES_PASSWORD:-gitea}
volumes:
- ./gitea:/data
ports:
- "${GITEA_HTTP_PORT:-3000}:3000"
- "${GITEA_SSH_PORT:-3022}:22"
depends_on:
db:
condition: service_healthy
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
db:
<<: *defaults
image: postgres:${POSTGRES_VERSION:-17.6}
environment:
- TZ=${TZ:-UTC}
- POSTGRES_USER=${POSTGRES_USER:-gitea}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-gitea}
- POSTGRES_DB=${POSTGRES_DB:-gitea}
volumes:
- postgres:/var/lib/postgresql/data
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
volumes:
gitea_data:
postgres: