Spaces:
Sleeping
Sleeping
Download Dockerfile from feldon0606/Democus: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/feldon0606/Democus/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/feldon0606/Democus/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/feldon0606/Democus/resolve/main/Dockerfile
1.34 kB
| # Use a stable base with wide wheel support | |
| FROM python:3.13.5-slim | |
| # Create non-root user matching HF Spaces expectations | |
| RUN useradd -m -u 1000 user | |
| # Environment & paths (install to user site-packages) | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \ | |
| STREAMLIT_USER_SETTINGS_DIR=/home/user/.streamlit | |
| WORKDIR $HOME/app | |
| # Optional system tools (if you truly need git/curl/build tools) | |
| # RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| # curl git build-essential && rm -rf /var/lib/apt/lists/* | |
| # Switch to the non-root user BEFORE pip so deps install to ~/.local | |
| USER user | |
| # Dependencies first for better layer caching | |
| COPY --chown=user requirements.txt . | |
| RUN pip install -r requirements.txt | |
| # App code | |
| COPY --chown=user . . | |
| # Ensure Streamlit settings dir exists & is writable | |
| RUN mkdir -p "$STREAMLIT_USER_SETTINGS_DIR" | |
| # Hugging Face sets $PORT; bind to it. Locally defaults to 8501. | |
| ENTRYPOINT ["bash","-lc","streamlit run src/streamlit_app.py --server.port=${PORT:-8501} --server.address=0.0.0.0"] | |
| EXPOSE 8501 | |
| # Healthcheck (uses shell so $PORT expands) | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ | |
| CMD bash -lc 'curl -fsS http://127.0.0.1:${PORT:-8501}/_stcore/health || exit 1' | |