File size: 1,116 Bytes
3048f61
 
9b6df9a
247414a
 
 
1cda8c2
 
247414a
 
3048f61
 
b4141f5
 
3048f61
9b6df9a
3048f61
446e390
9b6df9a
446e390
247414a
776c7bc
247414a
446e390
 
 
247414a
9b6df9a
776c7bc
9b6df9a
 
776c7bc
b4141f5
3048f61
9b6df9a
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
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

COPY package.json .
RUN npm install

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 2711

CMD ["node", "--max-old-space-size=512", "index.js"]