| FROM python:3.10-slim |
|
|
| |
| WORKDIR /app |
|
|
| |
| ENV PYTHONDONTWRITEBYTECODE=1 |
| ENV PYTHONUNBUFFERED=1 |
| ENV MPLCONFIGDIR=/tmp/matplotlib-cache |
| ENV PIP_DEFAULT_TIMEOUT=100 |
| ENV PIP_NO_CACHE_DIR=1 |
|
|
| |
| RUN mkdir -p /tmp/voices /tmp/output /tmp/matplotlib-cache && \ |
| chmod 777 /tmp/voices /tmp/output /tmp/matplotlib-cache |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| curl \ |
| ffmpeg \ |
| libsndfile1 \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN pip install --upgrade pip |
|
|
| |
| COPY requirements.txt . |
|
|
| |
| RUN pip install --no-cache-dir --timeout=100 --retries=5 -r requirements.txt |
|
|
| |
| COPY app.py . |
|
|
| |
| RUN useradd -m -u 1000 user |
| USER user |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ |
| CMD curl -f http://localhost:7860/api/health || exit 1 |
|
|
| |
| CMD ["python", "app.py"] |