Spaces:
Sleeping
Sleeping
File size: 847 Bytes
eec757a 873a169 493c63b de5862e 493c63b 873a169 eec757a 873a169 de5862e 873a169 eec757a 493c63b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Use the official Python image
FROM python:3.9
# Add a non-root user and set up the environment
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set Hugging Face cache directory and disable tokenizer parallelism
ENV HF_HOME=/app/hf_cache
ENV TOKENIZERS_PARALLELISM=false
# Set working directory
WORKDIR /app
# Copy dependencies first for caching
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Create cache directory for Hugging Face and ensure permissions
RUN mkdir -p /app/hf_cache && chown user:user /app/hf_cache
# Copy the rest of the application files
COPY --chown=user . /app
# Start Gunicorn with increased timeout and multiple workers
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "300", "--workers", "2", "chatbot:app"]
|