| |
| FROM python:3.11-slim |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| ffmpeg \ |
| curl \ |
| ca-certificates \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN ffmpeg -version && ffprobe -version |
|
|
| |
| RUN useradd -m -u 1000 user |
| USER user |
| ENV PATH="/home/user/.local/bin:$PATH" \ |
| PYTHONUNBUFFERED=1 \ |
| PYTHONDONTWRITEBYTECODE=1 \ |
| PIP_NO_CACHE_DIR=1 \ |
| PIP_DISABLE_PIP_VERSION_CHECK=1 |
|
|
| WORKDIR /app |
|
|
| |
| COPY --chown=user ./requirements.txt requirements.txt |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt |
|
|
| |
| COPY --chown=user . /app |
|
|
| |
| RUN mkdir -p /tmp/public && chmod 777 /tmp/public |
|
|
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \ |
| CMD curl -f http://localhost:7860/health || exit 1 |
|
|
| |
| CMD ["uvicorn", "app:app", \ |
| "--host", "0.0.0.0", \ |
| "--port", "7860", \ |
| "--workers", "1", \ |
| "--log-level", "info", \ |
| "--timeout-keep-alive", "120", \ |
| "--limit-concurrency", "100"] |