| |
| |
|
|
| |
| FROM node:20-alpine AS frontend-builder |
|
|
| WORKDIR /app/frontend |
|
|
| |
| COPY frontend/package.json frontend/yarn.lock ./ |
|
|
| |
| RUN yarn install --frozen-lockfile |
|
|
| |
| COPY frontend/ ./ |
|
|
| |
| ENV VITE_API_URL=/api |
|
|
| |
| RUN yarn build |
|
|
| |
| FROM python:3.12-slim |
|
|
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| git \ |
| wget \ |
| curl \ |
| build-essential \ |
| libsndfile1 \ |
| libsndfile1-dev \ |
| ffmpeg \ |
| sox \ |
| libsox-dev \ |
| libsox-fmt-all \ |
| libavcodec-dev \ |
| libavformat-dev \ |
| libavutil-dev \ |
| libswresample-dev \ |
| nginx \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN pip install --no-cache-dir uv |
|
|
| |
| COPY pyproject.toml /app/ |
| COPY backend /app/backend |
|
|
| |
| RUN uv pip install --system --no-cache \ |
| torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 \ |
| --index-url https://download.pytorch.org/whl/cpu && \ |
| uv pip install --system --no-cache \ |
| qwen-tts \ |
| fastapi \ |
| uvicorn[standard] \ |
| python-multipart \ |
| soundfile \ |
| huggingface-hub \ |
| tqdm |
|
|
| |
| COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist |
|
|
| |
| RUN mkdir -p /app/backend/uploads /app/backend/outputs |
|
|
| |
| RUN echo 'server { \n\ |
| listen 7860; \n\ |
| server_name _; \n\ |
| \n\ |
| |
| client_max_body_size 20M; \n\ |
| \n\ |
| |
| location / { \n\ |
| root /app/frontend/dist; \n\ |
| try_files $uri $uri/ /index.html; \n\ |
| } \n\ |
| \n\ |
| |
| location /api { \n\ |
| proxy_pass http://127.0.0.1:8000; \n\ |
| proxy_http_version 1.1; \n\ |
| proxy_set_header Upgrade $http_upgrade; \n\ |
| proxy_set_header Connection "upgrade"; \n\ |
| proxy_set_header Host $host; \n\ |
| proxy_set_header X-Real-IP $remote_addr; \n\ |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; \n\ |
| proxy_set_header X-Forwarded-Proto $scheme; \n\ |
| proxy_read_timeout 300s; \n\ |
| } \n\ |
| }' > /etc/nginx/sites-available/default |
|
|
| |
| ENV PYTHONUNBUFFERED=1 |
| ENV MODEL_PATH=/app/models/Qwen3-TTS-12Hz-1.7B-Base |
| ENV UPLOAD_DIR=/app/backend/uploads |
| ENV OUTPUT_DIR=/app/backend/outputs |
| ENV USE_CPU=true |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \ |
| CMD curl -f http://localhost:7860/api/status || exit 1 |
|
|
| |
| COPY docker-entrypoint.sh /app/ |
| RUN chmod +x /app/docker-entrypoint.sh |
|
|
| CMD ["/app/docker-entrypoint.sh"] |
|
|