Spaces:
Sleeping
Sleeping
| # Dockerfile - Streamlit app for huggingface model | |
| FROM python:3.13.5-slim | |
| ENV PYTHONUNBUFFERED=1 \ | |
| HF_HOME=/tmp/huggingface \ | |
| TRANSFORMERS_CACHE=/tmp/huggingface/transformers \ | |
| HF_DATASETS_CACHE=/tmp/huggingface/datasets \ | |
| HUGGINGFACE_HUB_CACHE=/tmp/huggingface/hub \ | |
| XDG_CACHE_HOME=/tmp/huggingface \ | |
| HOME=/tmp | |
| WORKDIR /app | |
| # Install system deps | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| git \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # create cache dirs early (prevents permission errors in Spaces) | |
| RUN mkdir -p /tmp/huggingface/transformers /tmp/huggingface/datasets /tmp/huggingface/hub \ | |
| && chmod -R 777 /tmp/huggingface | |
| # copy requirements and install | |
| COPY requirements.txt /app/requirements.txt | |
| RUN python -m pip install --upgrade pip | |
| RUN pip install -r /app/requirements.txt | |
| # copy app | |
| COPY . /app | |
| # Expose Streamlit port (Spaces and local Streamlit default) | |
| EXPOSE 8501 | |
| # Healthcheck (simple) | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ | |
| CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # Start streamlit | |
| ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.headless=true", "--server.enableCORS=false", "--server.enableXsrfProtection=false"] | |