services:
  gravl-backend:
    container_name: gravl-backend
    build:
      context: ./backend
      dockerfile: Dockerfile
    restart: unless-stopped
    environment:
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_USER=postgres
      - DB_PASSWORD=homelab_postgres_2026
      - DB_NAME=gravl
    networks:
      - proxy
      - homelab
    expose:
      - "3001"

  gravl-frontend:
    container_name: gravl-frontend
    build:
      context: ./frontend
      dockerfile: Dockerfile
    restart: unless-stopped
    depends_on:
      - gravl-backend
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.gravl.rule=Host(`gravl.homelab.local`)"
      - "traefik.http.routers.gravl.entrypoints=web"
      - "traefik.http.routers.gravl.service=gravl"
      - "traefik.http.routers.gravl-secure.rule=Host(`gravl.homelab.local`)"
      - "traefik.http.routers.gravl-secure.entrypoints=websecure"
      - "traefik.http.routers.gravl-secure.tls=true"
      - "traefik.http.routers.gravl-secure.service=gravl"
      - "traefik.http.services.gravl.loadbalancer.server.port=80"

networks:
  proxy:
    external: true
  homelab:
    name: compose_homelab
    external: true
