| |
| |
| |
|
|
| FROM python:3.10-slim AS builder |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| build-essential \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN python -m venv /opt/venv |
| ENV PATH="/opt/venv/bin:$PATH" |
|
|
| |
| COPY requirements.txt /tmp/requirements.txt |
| RUN pip install --no-cache-dir --upgrade pip && \ |
| pip install --no-cache-dir -r /tmp/requirements.txt |
|
|
|
|
| |
| FROM python:3.10-slim |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| libsndfile1 \ |
| ffmpeg \ |
| && rm -rf /var/lib/apt/lists/* \ |
| && apt-get clean |
|
|
| |
| COPY --from=builder /opt/venv /opt/venv |
| ENV PATH="/opt/venv/bin:$PATH" |
|
|
| |
| RUN useradd --create-home --shell /bin/bash pockettts |
| WORKDIR /app |
|
|
| |
| COPY --chown=pockettts:pockettts app/ ./app/ |
| COPY --chown=pockettts:pockettts static/ ./static/ |
| COPY --chown=pockettts:pockettts templates/ ./templates/ |
| COPY --chown=pockettts:pockettts voices/ ./voices/ |
| COPY --chown=pockettts:pockettts server.py ./ |
|
|
| |
| RUN chown pockettts:pockettts /app && mkdir -p /app/logs && chown pockettts:pockettts /app/logs |
|
|
| |
| RUN mkdir -p /home/pockettts/.cache/huggingface && \ |
| chown -R pockettts:pockettts /home/pockettts/.cache |
|
|
| |
| RUN mkdir -p /app/voice_cache && chown pockettts:pockettts /app/voice_cache |
|
|
| |
| USER pockettts |
|
|
| |
| ENV POCKET_TTS_HOST=0.0.0.0 \ |
| POCKET_TTS_PORT=49112 \ |
| POCKET_TTS_VOICES_DIR=/app/voices \ |
| POCKET_TTS_LOG_DIR=/app/logs \ |
| POCKET_TTS_LOG_LEVEL=INFO \ |
| PYTHONUNBUFFERED=1 |
|
|
| |
| EXPOSE 49112 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:49112/health')" || exit 1 |
|
|
| |
| CMD ["python", "server.py"] |
|
|