---
# DOCKER_HOST=192.168.4.41:2376 docker-compose up -d
# DOCKER_HOST=dkhost:2376 docker stack deploy -c docker-compose.yml gitea

version: '3.4'
services:

  app:
    image: "gitea/gitea:latest"
    volumes:
      - /var/lib/gitea:/data
    ports:
      - "10022:22"
      - "10080:3000"

    deploy:
      mode: replicated
      replicas: 1
      restart_policy:
        condition: any
        delay: "10s"
        max_attempts: 6
      update_config:
        parallelism: 1
        delay: 2s
        order: start-first
      labels:
        net.xai-corp.gitea.description:  Self hosted github clone
      resources:
        limits:
          cpus: '0.5'
          memory: 96M

    healthcheck:
      test: ["CMD", "curl", "-If", "http://localhost:3000"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 20s

    logging:
      driver: fluentd
      options:
        fluentd-address: "logs.xai-corp.net:24224"
        fluentd-async-connect: 'true'
        tag: gitea

    networks:
      - prod_ui

networks:
  prod_ui:
    external:
      name: prod_ui
