version: "3"


networks:
    default:
        external:
            name: proxy_nginxproxy

services:
  gitea_server:
    image: gitea/gitea:1.19.0
    container_name: gitea
    environment:
      - VIRTUAL_HOST=git.micard-family.fr
      - LETSENCRYPT_HOST=git.micard-family.fr
      - LETSENCRYPT_EMAIL=emilien.micard@gmail.com
      - VIRTUAL_PORT=3000
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=mysql
      - GITEA__database__HOST=gitea_db:3306
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=5HhXC7NxGE75mM5E
    restart: always
    #networks:
    #  - gitea
    volumes:
      - /mnt/data/gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      #- "3001:3000"
      - "222:22"
    depends_on:
      - gitea_db

  gitea_db:
    image: mysql:8
    container_name: gitea_db
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=kfm9nATVxqVBqwQf
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=5HhXC7NxGE75mM5E
      - MYSQL_DATABASE=gitea
    #networks:
    #  - gitea
    volumes:
      - ./db:/var/lib/mysql


  backup-gitea:
    image: databack/mysql-backup
    container_name: "gitea-db-backup"
    restart: always
    user : 0:0
    depends_on:
      - gitea_db
    volumes:
     - /mnt/data/docker-backups/gitea-db:/db
    environment:
     - DB_DUMP_TARGET=/db
     - DB_USER=gitea
     - DB_PASS=5HhXC7NxGE75mM5E
     - DB_DUMP_FREQ=1440
     - DB_DUMP_BEGIN=+1
     - DB_SERVER=gitea_db