# Local dev override — use explicitly:
#   docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
# Isolated from the production stack so both can run on this host at once:
#   - distinct compose project name (separate network/grouping)
#   - distinct container names (-dev suffix; Docker rejects duplicate names)
#   - distinct image tag (local build doesn't clobber the prod :latest tag)
name: home-automation-dev

services:
  migration:
    build: .
    image: home-automation:dev
    container_name: home-automation-migration-dev
    environment:
      # In-container path for the mounted ./data volume (./data -> /app/data).
      # Overrides the host-absolute APP_DATABASE_URL in .env for local compose runs.
      APP_DATABASE_URL: "sqlite:////app/data/app.db"

  app:
    build: .
    image: home-automation:dev
    container_name: home-automation-app-dev
    # Publish on 8002 for dev. `!override` REPLACES the base ports list instead of
    # appending to it, so the dev stack does NOT also bind the production 8881.
    ports: !override
      - "127.0.0.1:8002:8000"
    environment:
      APP_DATABASE_URL: "sqlite:////app/data/app.db"
