sagar008's picture
Update Dockerfile
9ff09a0 verified
raw
history blame
1.04 kB
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
wget \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements with pinned versions
COPY requirements.txt .
# Install Python dependencies with pinned huggingface_hub
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Create cache directories with proper permissions
RUN mkdir -p /tmp/huggingface_cache /tmp/transformers_cache /app/nltk_data
RUN chmod 777 /tmp/huggingface_cache /tmp/transformers_cache
# Download NLTK data
RUN python -c "import nltk; nltk.download('punkt', download_dir='/app/nltk_data')"
# Copy application code
COPY . .
# Set environment variables for ALL cache directories
ENV PYTHONPATH=/app
ENV NLTK_DATA=/app/nltk_data
ENV HF_HOME=/tmp/huggingface_cache
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
ENV SENTENCE_TRANSFORMERS_HOME=/tmp/sentence_transformers_cache
ENV XDG_CACHE_HOME=/tmp
EXPOSE 7860
CMD ["python", "main.py"]