version: "3.9"

services:
  backend:
    build:
      context: ./backend
    container_name: XXX-backend
    environment:
      # credenciales del API (las mismas que usas ahora)
      BASIC_AUTH_USERNAME: "beyond"
      BASIC_AUTH_PASSWORD: "beyond2026"
      CACHE_DIR: "/data/cache"
    volumes:
      - cache-data:/data/cache
    expose:
      - "8000"
    networks:
      - XXX-beyond-net

  XXXfrontend:
    build:
      context: ./frontend
      args:
        # el front compilar con este BASE_URL -> /api
        VITE_API_BASE_URL: /api
    container_name: XXX-frontend
    expose:
      - "4173"
    networks:
      - XXX-beyond-net
      - frontend
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.XXX-server.rule=Host(`DDD`)"
      - "traefik.http.routers.XXX-server.entrypoints=websecure"
      - "traefik.http.routers.XXX-server.tls=true"
      - "traefik.http.routers.XXX-server.tls.certresolver=doresolv"
      - "traefik.http.routers.XXX-server.service=XXXfrontend"
      - "traefik.http.services.XXXfrontend.loadBalancer.server.port=4173"
    depends_on:
      - backend

volumes:
  cache-data:
    driver: local

networks:
  XXX-beyond-net:
    driver: bridge
  frontend:
    external: true 
