Spaces:
Sleeping
Sleeping
Download Dockerfile from Pankaj70/AHCGR-Legal-Inference: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/spaces/Pankaj70/AHCGR-Legal-Inference/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Pankaj70/AHCGR-Legal-Inference/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Pankaj70/AHCGR-Legal-Inference/resolve/main/Dockerfile
1.83 kB
| # ── Build stage ──────────────────────────────────────────────────────── | |
| FROM python:3.12-slim AS builder | |
| WORKDIR /app | |
| # Install uv for fast dependency management | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv | |
| # Copy project files | |
| COPY pyproject.toml . | |
| COPY src/ src/ | |
| # Install dependencies into .venv | |
| RUN uv venv .venv && \ | |
| uv pip install --no-cache -r pyproject.toml | |
| # ── Runtime stage ───────────────────────────────────────────────────── | |
| FROM python:3.12-slim | |
| WORKDIR /app | |
| # Copy the virtual environment from builder | |
| COPY --from=builder /app/.venv /app/.venv | |
| COPY --from=builder /app/src /app/src | |
| # Copy application files | |
| COPY ui/ ui/ | |
| COPY scripts/start_hf_space.sh scripts/start_hf_space.sh | |
| COPY deployment/qdrant/local_db/ deployment/qdrant/local_db/ | |
| # Set PATH to use .venv python | |
| ENV PATH="/app/.venv/bin:$PATH" | |
| ENV PYTHONPATH="/app/src" | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV QDRANT_PATH="/app/deployment/qdrant/local_db" | |
| # Download local inference models during image build so runtime startup is fast. | |
| RUN python -c "from ahcgr.services.embedding import EmbeddingService; from ahcgr.services.reranker import RerankerService; EmbeddingService(); RerankerService()" | |
| # Create logs directory | |
| RUN mkdir -p /app/logs && chmod +x /app/scripts/start_hf_space.sh | |
| # Expose API and Hugging Face Spaces ports | |
| EXPOSE 8000 | |
| EXPOSE 7860 | |
| # Run FastAPI locally, or the combined API + Streamlit process on Hugging Face Spaces. | |
| CMD ["sh", "-c", "if [ -n \"$SPACE_ID\" ]; then /app/scripts/start_hf_space.sh; else uvicorn ahcgr.api.server:create_app --factory --host 0.0.0.0 --port 8000; fi"] | |