Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +17 -14
Dockerfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
FROM node:20-slim
|
| 2 |
|
| 3 |
-
# Instalar dependências
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
wget \
|
| 6 |
unzip \
|
|
@@ -10,27 +10,30 @@ RUN apt-get update && apt-get install -y \
|
|
| 10 |
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
-
COPY
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
npm install express cors @xenova/transformers
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
RUN mkdir -p textToSpeech && \
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
tar -xzf piper.tar.gz && \
|
| 22 |
cp -r piper/* textToSpeech/ && \
|
| 23 |
chmod +x textToSpeech/piper && \
|
| 24 |
rm -rf piper piper.tar.gz
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
RUN mkdir -p textToSpeech/pt_BR && \
|
| 28 |
-
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 && \
|
| 29 |
-
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
|
| 30 |
-
|
| 31 |
-
# Definir LD_LIBRARY_PATH para encontrar as bibliotecas
|
| 32 |
ENV LD_LIBRARY_PATH=/app/textToSpeech/lib:$LD_LIBRARY_PATH
|
|
|
|
|
|
|
| 33 |
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
-
CMD ["node", "index.js"]
|
|
|
|
| 1 |
FROM node:20-slim
|
| 2 |
|
| 3 |
+
# Instalar dependências em paralelo
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
wget \
|
| 6 |
unzip \
|
|
|
|
| 10 |
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
+
COPY package*.json ./
|
| 14 |
+
RUN npm ci --only=production
|
| 15 |
|
| 16 |
+
COPY . .
|
|
|
|
| 17 |
|
| 18 |
+
# Download paralelo do Piper e modelo
|
| 19 |
+
RUN mkdir -p textToSpeech/pt_BR && \
|
| 20 |
+
# Download Piper em background
|
| 21 |
+
(wget -O piper.tar.gz https://github.com/rhasspy/piper/releases/download/2023.11.14-2/piper_linux_x86_64.tar.gz &) && \
|
| 22 |
+
# Download modelo em paralelo
|
| 23 |
+
(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 &) && \
|
| 24 |
+
(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 &) && \
|
| 25 |
+
wait && \
|
| 26 |
+
# Extrair Piper
|
| 27 |
tar -xzf piper.tar.gz && \
|
| 28 |
cp -r piper/* textToSpeech/ && \
|
| 29 |
chmod +x textToSpeech/piper && \
|
| 30 |
rm -rf piper piper.tar.gz
|
| 31 |
|
| 32 |
+
# Otimizações de performance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
ENV LD_LIBRARY_PATH=/app/textToSpeech/lib:$LD_LIBRARY_PATH
|
| 34 |
+
ENV NODE_ENV=production
|
| 35 |
+
ENV UV_THREADPOOL_SIZE=16
|
| 36 |
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
+
CMD ["node", "--max-old-space-size=512", "index.js"]
|