FROM python:3.13-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PYTHONPATH=/app WORKDIR /app RUN pip install --no-cache-dir uv COPY pyproject.toml ./ RUN if [ -f uv.lock ]; then \ uv export --no-dev --no-hashes > requirements.txt; \ else \ uv pip compile pyproject.toml -o requirements.txt; \ fi && \ pip install --no-cache-dir -r requirements.txt COPY . . RUN adduser --disabled-password --gecos "" appuser && \ chown -R appuser:appuser /app USER appuser EXPOSE 7860 HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]