Refactor Dockerfiles to use UBI9 base image and update dependencies
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -102,3 +102,4 @@ logs/
|
|||||||
# *.flac
|
# *.flac
|
||||||
# *.m4a
|
# *.m4a
|
||||||
# *.ogg
|
# *.ogg
|
||||||
|
*.sh
|
||||||
@@ -1,15 +1,21 @@
|
|||||||
FROM python:3.9
|
# Usar imagen base UBI9 de Python de Red Hat
|
||||||
|
FROM registry.access.redhat.com/ubi9/python-39:latest
|
||||||
|
|
||||||
|
# Usuario por defecto en las imágenes UBI es no-root (default)
|
||||||
|
USER 0
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Instalar dependencias básicas
|
# Instalar dependencias del sistema necesarias para PyTorch y Whisper
|
||||||
RUN apt-get update && apt-get install -y ffmpeg
|
RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
|
||||||
|
dnf install -y gcc-c++ make ffmpeg && \
|
||||||
|
dnf clean all
|
||||||
|
|
||||||
# Instalar torch con soporte CUDA y otras dependencias
|
# Copiar requirements.txt e instalar dependencias de Python
|
||||||
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
|
COPY requirements.txt .
|
||||||
RUN pip install pika openai-whisper
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Crear un script para descargar el modelo
|
# Crear un script para descargar el modelo Whisper durante la construcción de la imagen
|
||||||
RUN echo '\
|
RUN echo '\
|
||||||
import whisper\n\
|
import whisper\n\
|
||||||
import torch\n\
|
import torch\n\
|
||||||
@@ -24,6 +30,17 @@ print("Modelo descargado correctamente")\
|
|||||||
# Ejecutar el script para descargar el modelo durante la construcción
|
# Ejecutar el script para descargar el modelo durante la construcción
|
||||||
RUN python download_model.py
|
RUN python download_model.py
|
||||||
|
|
||||||
|
# Copiar código de la aplicación
|
||||||
COPY app.py .
|
COPY app.py .
|
||||||
|
|
||||||
|
# Crear directorio compartido y configurar permisos adecuados para OpenShift
|
||||||
|
RUN mkdir -p /app/shared && \
|
||||||
|
chmod -R 775 /app && \
|
||||||
|
chgrp -R 0 /app && \
|
||||||
|
chmod -R g=u /app
|
||||||
|
|
||||||
|
# Volver al usuario predeterminado de la imagen UBI (no-root)
|
||||||
|
USER default
|
||||||
|
|
||||||
|
# Comando para iniciar la aplicación
|
||||||
CMD ["python", "app.py"]
|
CMD ["python", "app.py"]
|
||||||
3
processor/requirements.txt
Normal file
3
processor/requirements.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
pika==1.3.2
|
||||||
|
torch>=2.0.0
|
||||||
|
openai-whisper>=20231117
|
||||||
@@ -1,11 +1,35 @@
|
|||||||
FROM python:3.9-slim
|
# Usar imagen base UBI9 de Python de Red Hat
|
||||||
|
FROM registry.access.redhat.com/ubi9/python-39:latest
|
||||||
|
|
||||||
|
# Usuario por defecto en las imágenes UBI es no-root (default)
|
||||||
|
USER 0
|
||||||
|
|
||||||
|
# Establecer directorio de trabajo
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Instalar dependencias
|
# Instalar ffmpeg usando el gestor de paquetes de Red Hat (dnf)
|
||||||
RUN apt-get update && apt-get install -y ffmpeg
|
RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
|
||||||
RUN pip install pika pydub
|
dnf install -y ffmpeg && \
|
||||||
|
dnf clean all
|
||||||
|
|
||||||
|
# Copiar archivos de la aplicación
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
# Instalar dependencias de Python
|
||||||
|
# Las imágenes UBI de Python utilizan pip-install en lugar de pip directamente
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copiar código de la aplicación
|
||||||
COPY app.py .
|
COPY app.py .
|
||||||
|
|
||||||
|
# Crear directorio compartido y configurar permisos adecuados para OpenShift
|
||||||
|
RUN mkdir -p /app/shared && \
|
||||||
|
chmod -R 775 /app && \
|
||||||
|
chgrp -R 0 /app && \
|
||||||
|
chmod -R g=u /app
|
||||||
|
|
||||||
|
# Volver al usuario predeterminado de la imagen UBI (no-root)
|
||||||
|
USER default
|
||||||
|
|
||||||
|
# Comando para iniciar la aplicación
|
||||||
CMD ["python", "app.py"]
|
CMD ["python", "app.py"]
|
||||||
2
splitter/requirements.txt
Normal file
2
splitter/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
pika==1.3.2
|
||||||
|
pydub==0.25.1
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
FROM python:3.9-slim
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Instalar dependencias
|
|
||||||
RUN pip install pika
|
|
||||||
|
|
||||||
COPY app.py .
|
|
||||||
|
|
||||||
CMD ["python", "app.py"]
|
|
||||||
1
unifier/requirements.txt
Normal file
1
unifier/requirements.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
pika==1.3.2
|
||||||
Reference in New Issue
Block a user