FROM ghcr.io/vectorize-io/hindsight:latest # HuggingFace Spaces requires port 7860 ENV HINDSIGHT_API_HOST=0.0.0.0 ENV HINDSIGHT_API_PORT=7860 ENV HINDSIGHT_API_LOG_LEVEL=info ENV HINDSIGHT_API_MCP_ENABLED=true ENV HINDSIGHT_API_RETAIN_EXTRACTION_MODE=concise ENV HINDSIGHT_API_RETAIN_EXTRACT_CAUSAL_LINKS=true ENV HINDSIGHT_API_RERANKER_PROVIDER=flashrank ENV HINDSIGHT_API_TENANT_EXTENSION=hindsight_api.extensions.builtin.tenant:ApiKeyTenantExtension # LLM: Google Gemini (set via HF Space secrets) # HINDSIGHT_API_LLM_PROVIDER=gemini # HINDSIGHT_API_LLM_API_KEY= # HINDSIGHT_API_LLM_MODEL=gemini-2.5-flash # Data directory (ephemeral on HF free tier — backup handles persistence) ENV HINDSIGHT_DATA_DIR=/data/hindsight # Backup configuration (set via HF Space secrets) # HF_TOKEN=hf_xxxxx # HF_BACKUP_REPO=Arnwald84/atum-hindsight-backup ENV BACKUP_INTERVAL_SECONDS=21600 # Install backup dependency and create data directory USER root RUN pip install --no-cache-dir huggingface_hub>=0.27.0 RUN mkdir -p /data/hindsight && chown hindsight:hindsight /data/hindsight # Copy backup/restore scripts COPY scripts/ /opt/backup/ RUN chmod +x /opt/backup/entrypoint.sh # Switch back to original user USER hindsight EXPOSE 7860 HEALTHCHECK --interval=30s --timeout=10s --retries=5 --start-period=300s \ CMD curl -f http://localhost:7860/health || exit 1 # Wrap original CMD with backup/restore entrypoint ENTRYPOINT ["/opt/backup/entrypoint.sh"] # CMD ["--model-id", "sentence-transformers/all-MiniLM-L6-v2", "--port", "7860"]