Spaces:
Running
Running
| FROM node:20-slim | |
| # Instalar dependências em paralelo | |
| RUN apt-get update && apt-get install -y \ | |
| wget \ | |
| unzip \ | |
| espeak-ng \ | |
| libespeak-ng1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| RUN npm init -y && \ | |
| npm install express cors @xenova/transformers | |
| COPY . . | |
| # Download sequencial | |
| RUN mkdir -p textToSpeech/pt_BR && \ | |
| wget -O piper.tar.gz https://github.com/rhasspy/piper/releases/download/2023.11.14-2/piper_linux_x86_64.tar.gz && \ | |
| tar -xzf piper.tar.gz && \ | |
| cp -r piper/* textToSpeech/ && \ | |
| chmod +x textToSpeech/piper && \ | |
| rm -rf piper piper.tar.gz && \ | |
| wget -O textToSpeech/pt_BR/pt_BR-faber-medium.onnx https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/pt/pt_BR/faber/medium/pt_BR-faber-medium.onnx && \ | |
| wget -O textToSpeech/pt_BR/pt_BR-faber-medium.onnx.json https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/pt/pt_BR/faber/medium/pt_BR-faber-medium.onnx.json | |
| # Otimizações de performance | |
| ENV LD_LIBRARY_PATH=/app/textToSpeech/lib:$LD_LIBRARY_PATH | |
| ENV NODE_ENV=production | |
| ENV UV_THREADPOOL_SIZE=16 | |
| EXPOSE 7860 | |
| CMD ["node", "--max-old-space-size=512", "index.js"] |