name: turboci-admin

services:
  nginx:
    image: nginx:trixie
    env_file: .env
    depends_on:
      web:
        condition: service_healthy
    network_mode: host
    container_name: turboci-admin-nginx
    restart: always
    volumes:
      - ./docker/services/nginx/conf.d:/etc/nginx/conf.d
      - ./docker/services/nginx/nginx.conf:/etc/nginx/nginx.conf

  web:
    build:
      context: ./docker/services/web
      dockerfile: Dockerfile
    env_file: .env
    network_mode: host
    container_name: turboci-admin-web
    volumes:
      - .:/app
      - /root/.turboci:/root/.turboci
    expose:
      - 3772
    healthcheck:
      test: ["CMD", "curl", "--silent", "--fail", "http://localhost:3772/"]
      interval: 20s
      timeout: 5s
      retries: 5
      start_period: 4s
    restart: always

  websocket:
    build:
      context: ./docker/services/websocket
      dockerfile: Dockerfile
    env_file: .env
    container_name: turboci-admin-websocket
    hostname: turboci-admin-websocket
    volumes:
      - .:/app
      - /root/.turboci:/root/.turboci
    network_mode: host
    restart: always

  cron:
    build:
      context: ./docker/services/cron
      dockerfile: Dockerfile
    env_file: .env
    container_name: turboci-admin-cron
    hostname: turboci-admin-cron
    volumes:
      - .:/app
      - /root/.turboci:/root/.turboci
    restart: on-failure:10
    network_mode: host
