File size: 1,770 Bytes
b78f94d
18bb8fb
8a3fe7d
3ca3836
b488bca
3ca3836
b488bca
3ca3836
a85eb66
 
 
b78f94d
6a08b7e
b78f94d
 
7739ba6
 
b78f94d
 
3ca3836
0c3edc9
4e6d4cd
b488bca
b47a1a6
7f7bcff
b47a1a6
 
7f7bcff
 
 
3ca3836
7f7bcff
b78f94d
 
7c8d394
880e994
 
 
 
 
 
 
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
# Usa una imagen base oficial de Python
FROM python:3.12
ENV TEMP=/home/app/tmp
# Agrega un usuario no root
RUN useradd -m -u 1000 app

# Establece el directorio de trabajo dentro del contenedor
WORKDIR /home/app
#RUN wget https://huggingface.co/HirCoir/piper-all-models/resolve/main/es_MX-sorah.onnx; wget https://huggingface.co/HirCoir/piper-all-models/resolve/main/es_MX-sorah.onnx.json
#RUN wget https://huggingface.co/HirCoir/piper-all-models/resolve/main/kamora.onnx; wget https://huggingface.co/HirCoir/piper-all-models/resolve/main/kamora.onnx.json
#RUN wget https://huggingface.co/HirCoir/piper-all-models/resolve/main/es_MX-locutor-18488-epoch-high.onnx; wget https://huggingface.co/HirCoir/piper-all-models/resolve/main/es_MX-locutor-18488-epoch-high.onnx.json 
# Actualiza pip para asegurarte de tener la última versión
RUN pip install --upgrade pip

# Instala Flask en el entorno del contenedor
RUN pip install requests flask beautifulsoup4 markdown


# Copia solo los archivos necesarios para evitar copiar todo el directorio de trabajo
COPY --chown=app:app . .
RUN mkdir /home/app/templates/
COPY --chown=app:app index.html /home/app/templates/index.html

# Descarga el archivo tar.gz
RUN wget https://github.com/rhasspy/piper/releases/download/2023.11.14-2/piper_linux_x86_64.tar.gz

# Extrae el contenido del archivo tar.gz y renombra el binario si es necesario
RUN tar xvf piper_linux_x86_64.tar.gz && \
    mv piper piper_temp && \
    mv piper_temp/* . && \
    rm -rf piper_temp piper_linux_x86_64.tar.gz

# Expone el puerto en el que Flask se ejecutará dentro del contenedor
EXPOSE 7860

RUN echo '#!/bin/bash\n\
python app.py' > start.sh
# Haz que el script sea ejecutable
RUN chmod +x start.sh

# Ejecuta el script como CMD
CMD ["./start.sh"]