version: '3.8'

services:
  traefik:
    image: traefik:v2.10
    container_name: traefik
    command:
      - --api.dashboard=true
      - --api.insecure=true
      - --providers.docker=true
      - --providers.file.filename=/dynamic_conf/ssl.yml
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
    ports:
      - "209.182.212.251:80:80"
      - "209.182.212.251:443:443"
      - "8081:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./ssl:/ssl:ro
      - ./dynamic_conf:/dynamic_conf:ro
    networks:
      - web

  lia-sollers:
    build: .
    container_name: lia-sollers
    env_file:
      - .env
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.lia.rule=Host(`lia.gruposollers.com`)"
      - "traefik.http.routers.lia.entrypoints=websecure"
      - "traefik.http.routers.lia.tls=true"
      - "traefik.http.routers.lia.service=lia-service"
      - "traefik.http.services.lia-service.loadbalancer.server.port=8000"
    ports:
      - "8000:8000"
    healthcheck:
      test: ["CMD-SHELL", "curl --fail http://localhost:8000/health || exit 1"]
      interval: 30s
      timeout: 5s
      retries: 3
    networks:
      - web

networks:
  web:
    external: true