FROM python:3.9-slim | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
libgl1-mesa-glx \ | |
libglib2.0-0 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create a directory for the Hugging Face cache and make it writable | |
RUN mkdir -p /huggingface_cache && chmod 777 /huggingface_cache | |
ENV TRANSFORMERS_CACHE=/huggingface_cache | |
ENV HF_HOME=/huggingface_cache | |
# Copy requirements first to leverage Docker cache | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY app.py . | |
# Create uploads directory | |
RUN mkdir -p uploads && chmod 777 uploads | |
# Expose port | |
EXPOSE 5000 | |
# Run the application | |
CMD ["python", "app.py"] |