Spaces:
Sleeping
Sleeping
Download Dockerfile from Learnerbegginer/Buddy-ChatBot: direct link, hf CLI and curl.
- Browser
- Download file 960 Bytes
-
https://huggingface.co/spaces/Learnerbegginer/Buddy-ChatBot/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Learnerbegginer/Buddy-ChatBot/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Learnerbegginer/Buddy-ChatBot/resolve/main/Dockerfile
960 Bytes
| FROM python:3.9-slim | |
| # Create a non-root user | |
| RUN useradd -m appuser | |
| # Set environment variables for Hugging Face cache | |
| ENV TRANSFORMERS_CACHE=/app/cache | |
| ENV HF_HOME=/app/cache | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements and install them | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Create cache directory and set permissions | |
| RUN mkdir -p /app/cache && chown -R appuser /app/cache | |
| # Pre-download the model during build time | |
| RUN python3 -c "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \ | |
| AutoTokenizer.from_pretrained('ai4bharat/IndicBART', use_fast=False); \ | |
| AutoModelForSeq2SeqLM.from_pretrained('ai4bharat/IndicBART')" | |
| # Copy all project files and set ownership | |
| COPY . . | |
| RUN chown -R appuser /app | |
| # Switch to non-root user | |
| USER appuser | |
| # Expose port for Streamlit | |
| EXPOSE 7860 | |
| # Run the Streamlit app | |
| CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] | |