audio_texto_XD / Dockerfile
JairoDanielMT's picture
Update Dockerfile
693ef1a verified
# Etapa 1: Agregar componentes espec铆ficos de CUDA y utilidades b谩sicas
FROM nvidia/cuda:11.3.1-base-ubuntu20.04 AS base
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Europe/Paris
# Instalar utilidades b谩sicas y ffmpeg
RUN apt-get update && apt-get install -y \
curl \
git \
unzip \
wget \
zip \
git-lfs \
ffmpeg
# Agregar la ubicaci贸n de ffprobe al PATH
ENV PATH="${PATH}:/usr/bin"
# Crear el directorio /app en la etapa base
WORKDIR /app
# Etapa 2: Instalaci贸n de dependencias de Python y construcci贸n de la aplicaci贸n
FROM python:3.10
# Copiar archivos de la aplicaci贸n
WORKDIR /app
COPY . .
# Instalar dependencias de Python
RUN pip install --no-cache-dir pandas numpy nltk moviepy pydub transformers pydantic pytest fastapi uvicorn torch torchvision torchaudio
# Instalar paquete especial whisperx desde GitHub
RUN pip install git+https://github.com/m-bain/whisperx.git
# Instalar dependencias desde requirements.txt
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copiar la aplicaci贸n desde la etapa anterior
COPY --from=base /app .
ENV MPLCONFIGDIR=/tmp/matplotlib
ENV TRANSFORMERS_CACHE=/tmp/huggingface
# Cambiar permisos de archivos necesarios
RUN chmod -R 777 /app
RUN if [ ! -d "/.cache" ]; then mkdir /.cache; fi && chmod -R 777 /.cache
RUN mkdir -p /.cache && chmod -R 777 /.cache
# Definir comando predeterminado para iniciar la aplicaci贸n
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]