version: '3'

services:
  app:
    # Latest contains a development version
    image: 'gitea/gitea:1.20.1'
    restart: 'always'

    ports:
      - '8016:22'
      - '8010:3000'
    volumes:
      # - '/etc/gitea/app.ini:/data/gitea/conf/app.ini'
      - '/mnt/data1/gitea/data:/data'
      - '/mnt/data1/gitea/repositories:/data/git/repositories'
      - '/mnt/data1/gitea/lfs:/data/git/lfs'
      - '/etc/timezone:/etc/timezone:ro'
      - '/etc/localtime:/etc/localtime:ro'

    depends_on:
      db:
        condition: service_healthy

  db:
    image: 'postgres:14.8-alpine'
    restart: 'always'

    healthcheck:
      test: ["CMD", "pg_isready", "-U", "gitea"]
      interval: 30s 
      start_period: 30s
      timeout: 5s
      retries: 3

    environment:
      - 'POSTGRES_USER=gitea'
      - 'POSTGRES_PASSWORD=gitea'
      - 'POSTGRES_DB=gitea'
    volumes:
      - '/mnt/data1/gitea/postgres:/var/lib/postgresql/data'
