smartdocs-api / Dockerfile.streamlit
Sahilalaknur's picture
Clean HF API deploy (no binary history)
fa1fead
Raw History Blame Contribute Delete
1.48 kB
# ── SmartDocs Streamlit UI β€” Hugging Face Spaces Docker ───────────────────────
FROM python:3.13-slim-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:0.5.17 /uv /usr/local/bin/
# HF Spaces requires user 1000
RUN useradd -m -u 1000 -s /bin/bash appuser
WORKDIR /app
# Lightweight UI deps only β€” no torch, no ML libraries
RUN uv venv .venv && \
uv pip install --python .venv/bin/python \
streamlit httpx pydantic "pydantic-settings" \
python-dotenv pyyaml
# Copy only UI and config β€” not the entire backend
COPY --chown=appuser:appuser ui/ ./ui/
COPY --chown=appuser:appuser config/ ./config/
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONPATH="/app" \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PORT=7860
RUN mkdir -p /app/.streamlit && \
printf '[general]\nemail = ""\n[browser]\ngatherUsageStats = false\n[server]\nheadless = true\nenableCORS = false\nenableXsrfProtection = false\n' \
> /app/.streamlit/config.toml && \
chown -R appuser:appuser /app
USER appuser
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/_stcore/health')" || exit 1
CMD ["streamlit", "run", "ui/app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]