Spaces:
Sleeping
Sleeping
File size: 1,484 Bytes
fa1fead | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # ββ 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"] |