questionANDanswering / Dockerfile
oussamatahkoubit's picture
Upload 8 files
85690b9 verified
raw
history blame contribute delete
790 Bytes
FROM python:3.9-slim
WORKDIR /app
# Create a writable cache directory
RUN mkdir -p /tmp/hf_cache && chmod 777 /tmp/hf_cache
ENV TRANSFORMERS_CACHE=/tmp/hf_cache
ENV HF_HOME=/tmp/hf_cache
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Try to install NLTK data for fallback mechanism
RUN python -c "import nltk; nltk.download('punkt')" || echo "NLTK download failed but we can continue"
# Copy application code
COPY . .
# Create uploads directory
RUN mkdir -p /tmp/uploads && chmod 777 /tmp/uploads
# Set environment variables
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
# Expose port for Hugging Face
EXPOSE 7860
# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]