Spaces:
Build error
Build error
| # Usar una imagen base de Python con soporte para Debian/Ubuntu | |
| FROM python:3.10-slim | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| xz-utils \ | |
| libxrender1 \ | |
| libxi6 \ | |
| libxxf86vm1 \ | |
| libfontconfig1 \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| libx11-6 \ | |
| libxfixes3 \ | |
| libxkbcommon0 \ | |
| libsm6 \ | |
| libice6 \ | |
| libxcursor1 \ | |
| libxrandr2 \ | |
| libxinerama1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Descargar e Instalar Blender (versi贸n recomendada 4.2 LTS) | |
| RUN curl -L "https://download.blender.org/release/Blender4.2/blender-4.2.0-linux-x64.tar.xz" -o blender.tar.xz \ | |
| && tar -xf blender.tar.xz -C /opt \ | |
| && mv /opt/blender-4.2.0-linux-x64 /opt/blender \ | |
| && ln -s /opt/blender/blender /usr/local/bin/blender \ | |
| && rm blender.tar.xz | |
| # Crear un usuario con UID 1000 (Hugging Face Spaces corre con UID 1000) | |
| RUN useradd -m -u 1000 user | |
| # Configurar variables de entorno del usuario | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Crear y establecer el directorio de trabajo | |
| WORKDIR $HOME/app | |
| # Copiar dependencias de Python e instalarlas | |
| COPY --chown=user backend/requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt | |
| # Copiar el c贸digo del proyecto al contenedor con propiedad del usuario | |
| COPY --chown=user . $HOME/app | |
| # Crear carpetas temporales y de almacenamiento y asignar la propiedad al usuario | |
| RUN mkdir -p backend/data backend/generated/images backend/generated/models && chown -R user:user backend/data backend/generated | |
| # Cambiar al usuario no ra铆z | |
| USER user | |
| # Indicar que usaremos el puerto de Hugging Face | |
| EXPOSE 7860 | |
| # Comando para arrancar el servidor (usando -u para ver los logs en tiempo real) | |
| CMD ["python", "-u", "backend/server.py"] | |