Spaces:
Sleeping
Sleeping
# Use an official Python runtime as a parent image | |
FROM python:3.9 | |
# Set environment variables early | |
ENV HF_HOME="/tmp/huggingface" | |
ENV HF_DATASETS_CACHE="/tmp/huggingface/datasets" | |
ENV TRANSFORMERS_CACHE="/tmp/huggingface/transformers" | |
ENV HF_HUB_CACHE="/tmp/huggingface/hub" | |
# Ensure cache directories exist and are writable | |
RUN mkdir -p $HF_DATASETS_CACHE $TRANSFORMERS_CACHE $HF_HUB_CACHE | |
RUN chmod -R 777 /tmp/huggingface # Give full permissions | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy the application files to the container | |
COPY . /app | |
# Install dependencies (after setting cache paths) | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Expose the application port | |
EXPOSE 7860 | |
# Start the Flask app with Gunicorn | |
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "app:app"] | |