Spaces:
Sleeping
Sleeping
Download Dockerfile from dejanai/reverse-prompter: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/spaces/dejanai/reverse-prompter/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/dejanai/reverse-prompter/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/dejanai/reverse-prompter/resolve/main/Dockerfile
1.32 kB
| FROM python:3.11-slim | |
| # 1. Install OS build dependencies and curl | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 2. Set up user 1000 (required by Hugging Face Spaces) | |
| RUN useradd -m -u 1000 user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PYTHONUNBUFFERED=1 \ | |
| HF_HOME=/home/user/.cache/huggingface | |
| WORKDIR $HOME/app | |
| # 3. Install Python dependencies as user | |
| COPY --chown=user:user requirements.txt . | |
| USER user | |
| RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # 4. Pre-download model & tokenizer into image layer so startup is instant | |
| RUN python -c "from transformers import AutoModelForCausalLM, AutoTokenizer; \ | |
| AutoModelForCausalLM.from_pretrained('dejanseo/reverse-prompter'); \ | |
| AutoTokenizer.from_pretrained('dejanseo/reverse-prompter')" | |
| # 5. Copy application source | |
| COPY --chown=user:user . . | |
| EXPOSE 7860 | |
| # 6. Streamlit startup flags configured for HF Spaces iframe and port 7860 | |
| CMD ["streamlit", "run", "src/streamlit_app.py", \ | |
| "--server.port=7860", \ | |
| "--server.address=0.0.0.0", \ | |
| "--server.headless=true", \ | |
| "--server.enableCORS=false", \ | |
| "--server.enableXsrfProtection=false"] |