services:
  web:
    image: gitea/gitea
    container_name: ${gitServName}
    restart: ${restartPolicy}
    ports:
#       - 8088:3000/tcp
       - 2202:22/tcp
    networks:
      - giteaNet
      - postfixNet
    external_links:
      - ${smtpServName}:${smtpHost}
    volumes:
      - gitData:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - db
    environment:
      - USER_UID=1000
      - USER_GID=1000
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.${gitServName}.rule=Host(`${gitHost}.${domain}`)"
      - "traefik.http.services.${gitServName}.loadbalancer.server.port=3000"
      - "traefik.docker.network=giteaNet"

  db:
    image: mariadb
    container_name: ${gitDBName}
    restart: ${restartPolicy}
    env_file:
      - ../../secret/env-${gitDBName}
    environment:
      - MARIADB_AUTO_UPGRADE=1    
    volumes:
      - gitDB:/var/lib/mysql
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    networks:
      - giteaNet

volumes:
  gitDB:
  gitData:

networks:
  giteaNet:
    external: true
    name: giteaNet
  postfixNet:
    external: true
    name: postfixNet
