services:
  auth-frontend:
    restart: unless-stopped
    networks:
      - lyphenet
    env_file: ".env"
    depends_on:
      - nats
      - authservice
    build:
      dockerfile: Dockerfile.auth-frontend
    volumes:
      - auth_frontend_data:/data
    image: asklyphe/auth-frontend
  authservice:
    restart: unless-stopped
    networks:
      - lyphenet
    env_file: ".env"
    depends_on:
      - nats
    build:
      dockerfile: Dockerfile.authservice
    image: asklyphe/authservice
  frontend:
    restart: unless-stopped
    networks:
      - lyphenet
    env_file: ".env"
    depends_on:
      - nats
    build:
      dockerfile: Dockerfile.frontend
    volumes:
      - frontend_data:/data
    image: asklyphe/frontend
#   vorebot:
#     restart: unless-stopped
#     networks:
#       - lyphenet
#       - outer
#     env_file: ".env"
#     depends_on:
#       - nats
#     build:
#       dockerfile: Dockerfile.vorebot
#     image: asklyphe/vorebot

  bingservice:
    restart: unless-stopped
    networks:
      - lyphenet
      - outer
    env_file: ".env"
    depends_on:
      - nats
    build:
      dockerfile: Dockerfile.bingservice
    volumes:
      - ./proxies.txt:/data/proxies.txt
    image: asklyphe/bingservice
  googleservice:
    restart: unless-stopped
    networks:
      - lyphenet
      - outer
    env_file: ".env"
    depends_on:
      - nats
      - bingservice
    build:
      dockerfile: Dockerfile.googleservice
    image: asklyphe/googleservice

  nats:
    restart: unless-stopped
    networks:
      - lyphenet
    depends_on:
      - db
    env_file: ".env"
    image: nats:2.11.8
    command: "-js"
  db:
    image: postgres:17
    networks:
      - lyphenet
    env_file: ".env"
    healthcheck:
      test: ['CMD', 'pg_isready', '-U', 'postgres']
    volumes:
      - ./database:/var/lib/postgresql/data
  proxy:
    image: nginx:latest
    networks:
      - lyphenet
      - outer
    depends_on:
      - frontend
      - auth-frontend
    volumes:
      - ./nginx:/etc/nginx/conf.d
      - frontend_data:/data/frontend
      - auth_frontend_data:/data/auth-frontend
    ports:
      - "1234:80"
      - "1235:81"
#   caddy:
#     image: caddy:latest
#     networks:
#       - lyphenet
#       - outer
#     depends_on:
#       - frontend
#       - auth-frontend
#     volumes:
#       - ./Caddyfile:/etc/caddy/Caddyfile
#     ports:
#       - 1234:1234
#       - 1235:1235

networks:
  outer:
  lyphenet:
    internal: true

volumes:
  frontend_data:
  auth_frontend_data:
