Spaces:
Sleeping
Sleeping
| # Hugging Face Spaces (Docker SDK) image for the romance chat app. | |
| FROM python:3.11-slim | |
| # System deps: git for HF model downloads, build tools for sentencepiece. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # HF Spaces runs containers as a non-root user (uid 1000). Match that so the | |
| # app can write its per-session data and model cache. | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| HF_HOME=/home/user/.cache/huggingface \ | |
| STREAMLIT_SERVER_HEADLESS=true \ | |
| STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
| WORKDIR /home/user/app | |
| # Install the CPU build of torch explicitly (the default PyPI wheel is CUDA and huge). | |
| RUN pip install --upgrade pip && \ | |
| pip install --user torch==2.6.0 --index-url https://download.pytorch.org/whl/cpu | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --user -r requirements.txt | |
| COPY --chown=user . . | |
| EXPOSE 7860 | |
| # HF Spaces expects the app on the port declared as app_port in README.md (7860). | |
| CMD ["sh", "-c", "streamlit run core/app.py --server.port=${PORT:-7860} --server.address=0.0.0.0 --server.enableCORS=false --server.enableXsrfProtection=false"] | |