# Gitea with PostgreSQL - Docker Compose # # Based on: https://docs.gitea.com/installation/install-with-docker # Healthchecks from: https://docs.gitea.com/installation/install-on-kubernetes # https://github.com/go-gitea/gitea/pull/35513 # # Generated by Ansible - do not edit manually. networks: gitea: external: false volumes: gitea: driver: local postgres: driver: local services: db: image: postgres:{{ gitea_postgres_version }} container_name: {{ gitea_db_container_name }} restart: always environment: - POSTGRES_USER={{ gitea_db_user }} - POSTGRES_PASSWORD={{ gitea_db_password }} - POSTGRES_DB={{ gitea_db_name }} networks: - gitea volumes: - postgres:/var/lib/postgresql/data # PostgreSQL readiness check healthcheck: test: ["CMD", "pg_isready", "-U", "{{ gitea_db_user }}", "-d", "{{ gitea_db_name }}"] interval: 10s timeout: 5s retries: 5 start_period: 10s server: image: docker.io/gitea/gitea:{{ gitea_version }} container_name: {{ gitea_container_name }} restart: always environment: - USER_UID={{ gitea_user_uid }} - USER_GID={{ gitea_user_gid }} - GITEA__database__DB_TYPE={{ gitea_db_type }} - GITEA__database__HOST={{ gitea_db_host }} - GITEA__database__NAME={{ gitea_db_name }} - GITEA__database__USER={{ gitea_db_user }} - GITEA__database__PASSWD={{ gitea_db_password }} networks: - gitea volumes: - /home/git/.ssh/:/data/git/.ssh - gitea:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ports: - "443:{{ gitea_http_port }}" - "127.0.0.1:{{ gitea_ssh_external_port }}:{{ gitea_ssh_port }}" depends_on: db: condition: service_healthy # Gitea health endpoint (per K8s docs and PR #35513) # start_period allows time for database migrations on upgrade healthcheck: test: ["CMD", "curl", "-fSs", "http://127.0.0.1:{{ gitea_http_port }}/api/healthz"] interval: 30s timeout: 10s retries: 5 start_period: 120s