FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PORT=7860 WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch==2.5.1 && \ pip install --no-cache-dir -r requirements.txt COPY . . RUN mkdir -p /app/static EXPOSE 7860 HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ CMD python -c "import os, urllib.request; urllib.request.urlopen(f'http://localhost:{os.environ.get(\"PORT\", \"7860\")}/')" || exit 1 CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860}"]