FROM python:3.9-slim | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
git \ | |
curl \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Python dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application files | |
COPY . . | |
# Expose port | |
EXPOSE 7860 | |
# Set environment variables | |
ENV PYTHONPATH=/app | |
ENV TRANSFORMERS_CACHE=/app/cache | |
ENV HF_HOME=/app/cache | |
# Create cache directory | |
RUN mkdir -p /app/cache | |
# Run the application | |
CMD ["python", "app.py"] |