version: '2'

services:
  gitea:
    image: "${gitea_image}:${gitea_version}"
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
    volumes:
      - gitea-data:/data:Z
    ports:
      - ${weblisten_if}:${weblisten_port}:3000
      - ${sshlisten_if}:${sshlisten_port}:22
    healthcheck:
      test: ["CMD", "curl", "-fSs", "http://localhost:3000/api/healthz"]
      interval: 60s
      timeout: 10s
      retries: 3
      start_period: 5s
    depends_on:
      - db

  db:
    image: "${postgres_image}:${postgres_version}"
    container_name: gitea-db
    volumes:
      - gitea-pgsql:/var/lib/postgresql/data:Z
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U gitea"]
      interval: 60s
      timeout: 10s
      retries: 3
      start_period: 5s

volumes:
  gitea-data:
  gitea-pgsql: