services:
  web:
    # build:
    #   context: ./dbapp
    #   dockerfile: Dockerfile
    image: registry.geraltserv.ru/geolocation:latest
    env_file:
      - .env.prod
    depends_on:
      - db
    volumes:
      - static_volume:/app/staticfiles
      - ./logs:/app/logs
    expose:
      - 8000

  worker:
    # build:
    #   context: ./dbapp
    #   dockerfile: Dockerfile
    image: registry.geraltserv.ru/geolocation:latest
    env_file:
      - .env.prod
    entrypoint: ["/app/entrypoint-celery.sh"]
    command: ["uv", "run", "celery", "-A", "dbapp", "worker", "--loglevel=INFO", "--concurrency=2"]
    depends_on:
      - db
      - redis
    volumes:
      - ./logs:/app/logs
    restart: unless-stopped

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    ports:
      - 6379:6379

  db:
    image: postgis/postgis:18-3.6
    container_name: postgres-postgis
    restart: unless-stopped
    env_file:
      - .env.prod
    ports:
      - 5432:5432
    volumes:
      - pgdata:/var/lib/postgresql
    # networks:
    #   - app-network

  nginx:
    image: nginx:alpine
    depends_on:
      - web
    ports:
      - 8080:80
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
      - static_volume:/usr/share/nginx/html/static
  
  flaresolverr:
    image: ghcr.io/flaresolverr/flaresolverr:latest
    container_name: flaresolverr
    restart: unless-stopped
    ports:
      - "8191:8191"
    environment:
      - LOG_LEVEL=info
      - LOG_HTML=false
      - CAPTCHA_SOLVER=none
  
  tileserver:
    image: maptiler/tileserver-gl:latest
    container_name: tileserver-gl
    restart: unless-stopped
    ports:
      - "8090:8080"
    volumes:
      - ./tileserver_data:/data
      - tileserver_config:/config
    environment:
      - VERBOSE=true
      - CORS_ENABLED=true

volumes:
  pgdata:
  static_volume:
  tileserver_config