| # syntax=docker/dockerfile:1 | |
| FROM python:3.10-slim | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| HF_HOME=/tmp/hf_cache \ | |
| HF_HUB_CACHE=/tmp/hf_cache/hub \ | |
| TRANSFORMERS_CACHE=/tmp/hf_cache/transformers | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libjpeg62-turbo zlib1g libglib2.0-0 libsm6 libxrender1 libxext6 curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| RUN pip install --upgrade pip && pip install -r requirements.txt | |
| COPY . . | |
| EXPOSE 7860 | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=10 \ | |
| CMD curl -fsS http://localhost:7860/ || exit 1 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |