File size: 1,492 Bytes
d715e26
 
d2ee1c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d715e26
d2ee1c3
 
d715e26
 
 
 
d2ee1c3
d715e26
d2ee1c3
d715e26
f0e871b
d715e26
 
 
 
d2ee1c3
 
d715e26
d2ee1c3
 
d715e26
d2ee1c3
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Dockerfile for SuperTonic3 OpenAI-Compatible Server
# ONNX-based TTS engine, no GPU required.

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 supertonic
WORKDIR /app

COPY --chown=supertonic:supertonic app/ ./app/
COPY --chown=supertonic:supertonic static/ ./static/
COPY --chown=supertonic:supertonic templates/ ./templates/
COPY --chown=supertonic:supertonic server.py ./

RUN chown supertonic:supertonic /app && mkdir -p /app/logs && chown supertonic:supertonic /app/logs

USER supertonic

ENV SUPERTONIC3_HOST=0.0.0.0 \
    SUPERTONIC3_PORT=7860 \
    SUPERTONIC3_LOG_DIR=/app/logs \
    SUPERTONIC3_LOG_LEVEL=INFO \
    PYTHONUNBUFFERED=1

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
    CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1

CMD ["python", "server.py"]