version: "3.8"

services:
  backend:
    build:
      context: ./backend_rust
      dockerfile: Dockerfile
      args:
        DOCKER_MIRROR: ${DOCKER_MIRROR:-}
    container_name: notify-backend
    restart: unless-stopped
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD}@host.docker.internal:5432/${POSTGRES_DB:-notify}
      JWT_SECRET: ${JWT_SECRET:?JWT_SECRET is required}
      BASE_URL: ${BASE_URL:-http://localhost}
    ports:
      - "127.0.0.1:4000:4000"
    volumes:
      - uploads_data:/app/uploads

  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
      args:
        DOCKER_MIRROR: ${DOCKER_MIRROR:-}
        NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost}
    container_name: notify-frontend
    restart: unless-stopped
    depends_on:
      - backend
    environment:
      NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost}
    ports:
      - "127.0.0.1:3001:3000"

volumes:
  uploads_data:
