services:
  meilisearch:
    image: getmeili/meilisearch:v1.7
    environment:
      MEILI_ENV: production
      MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
      MEILI_NO_ANALYTICS: "true"
    ports:
      - "7700:7700"
    volumes:
      - meili_data:/meili_data
    restart: unless-stopped

  search-api:
    build:
      context: ./search-api
    environment:
      PORT: 8080
      MEILI_HOST: http://meilisearch:7700
      MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}

      # Shared-host export endpoint + auth (VPS pulls from shared host)
      EXPORT_BASE_URL: ${EXPORT_BASE_URL}
      EXPORT_BEARER_TOKEN: ${EXPORT_BEARER_TOKEN}
      # Optional host header override (useful for local Docker -> host vhost routing)
      EXPORT_HOST_HEADER: ${EXPORT_HOST_HEADER}

      # Used by shared host when calling VPS /suggest
      SUGGEST_BEARER_TOKEN: ${SUGGEST_BEARER_TOKEN}

      # Index + sync options
      MEILI_INDEX: products
      SYNC_STORE_ID: ${SYNC_STORE_ID}
      SYNC_LIMIT: 500
    depends_on:
      - meilisearch
    ports:
      - "8080:8080"
    restart: unless-stopped

volumes:
  meili_data:

