FROM python:3.10-slim ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PORT=7860 \ HF_HOME=/tmp/cache \ TRANSFORMERS_CACHE=/tmp/cache \ TORCH_HOME=/tmp/cache/torch # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ curl \ git \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Create required directories RUN mkdir -p /tmp/cache /tmp/logs && \ chmod -R 777 /tmp/cache /tmp/logs # Copy only necessary files COPY requirements.txt . COPY app.py . COPY static/ static/ COPY templates/ templates/ # Install Python dependencies RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \ pip install --no-cache-dir -r requirements.txt EXPOSE 7860 CMD ["python", "app.py"]