magenta-rt-jam / Dockerfile
TJJ44's picture
Deploy Magenta RT 2 en Gradio
ee3bf03
Raw History Blame Contribute Delete
1.12 kB
# Dockerfile optimizado para Hugging Face Space (SDK Docker con GPU / CUDA 12.4)
FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime
# Variables de entorno para Hugging Face y PyTorch
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PORT=7860 \
GRADIO_SERVER_PORT=7860 \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_SSR_MODE=false \
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
MRT_LOAD=small
# Instalar dependencias del sistema requeridas para audio (libsndfile) y compilación
RUN apt-get update && apt-get install -y --no-install-recommends \
libsndfile1 \
git \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Crear usuario estándar no-root (requerimiento de seguridad de Hugging Face Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copiar requirements y hacer install
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copiar el resto del código del Space
COPY --chown=user:user . .
EXPOSE 7860
CMD ["python", "app.py"]