services:
  server:
    image: opensign/opensignserver:main
    container_name: OpenSignServer-container
    volumes:
      - opensign-files:/usr/src/app/files
    ports:
      - "8080:8080"
    depends_on:
      - mongo
    env_file: .env.prod
    environment:
      - NODE_ENV=production
      - SERVER_URL=${HOST_URL:-https://localhost:3001}/api/app
      - PUBLIC_URL=${HOST_URL:-https://localhost:3001}
    networks:
      - app-network
  mongo:
    image: mongo:latest
    container_name: mongo-container
    volumes:
      - data-volume:/data/db
    ports:
      - "27018:27017"
    networks:
      - app-network
  client:
    image: opensign/opensign:main
    container_name: OpenSign-container
    depends_on:
      - server
    env_file: .env.prod  
    ports:
      - "3000:3000"
    networks:
      - app-network
  caddy:
    image: caddy:latest
    container_name: caddy-container
    ports:
      - "3001:3001"
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
      - caddy_config:/config
    networks:
      - app-network
    environment:
      - HOST_URL=${HOST_URL:-localhost:3001}
networks:
  app-network:
    driver: bridge

volumes:
  data-volume:
  web-root:
  caddy_data:
  caddy_config:
  opensign-files:
