| |
| FROM python:3.11-slim |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| build-essential \ |
| ffmpeg \ |
| portaudio19-dev \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd -m -u 1000 user |
| USER user |
| ENV PATH="/home/user/.local/bin:${PATH}" |
|
|
| |
| WORKDIR /app |
|
|
| |
| COPY --chown=user:user requirements.txt . |
| RUN pip install --no-cache-dir --user -r requirements.txt |
|
|
| |
| COPY --chown=user:user main.py . |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1 |
|
|
| |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "1800"] |
|
|