Spaces:
Running
Running
| FROM python:3.10-slim | |
| # 1. Instalar dependencias (¡Ahora con CMAKE!) | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| git \ | |
| wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # 2. Clonar el repositorio | |
| RUN git clone https://github.com/Zhayr1/bitmamba.cpp.git | |
| # 3. Entrar en la carpeta | |
| WORKDIR /app/bitmamba.cpp | |
| # 4. Compilar con CMake | |
| # -B build: crea los archivos en una carpeta llamada 'build' | |
| RUN cmake -B build | |
| RUN cmake --build build | |
| # 5. MOVER EL BINARIO (Importante) | |
| # CMake suele dejar el ejecutable dentro de la carpeta 'build'. | |
| # Lo movemos a la raíz actual para que tu app.py lo encuentre en "./bitmamba" | |
| RUN mv build/bitmamba . | |
| # 6. Descargar el modelo (Ejemplo 1B) | |
| RUN wget -O bitmamba_1b.bin https://huggingface.co/Zhayr1/BitMamba-2-1B/resolve/main/bitmamba_cpp/bitmamba_1b.bin | |
| # 7. Instalar Gradio | |
| RUN pip install --no-cache-dir gradio | |
| # 8. Copiar tu script de interfaz | |
| COPY app.py . | |
| # 9. Configurar usuario no-root (Seguridad de HF) | |
| RUN useradd -m -u 1000 user | |
| RUN chown -R user:user /app/bitmamba.cpp | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 10. Ejecutar | |
| CMD ["python", "app.py"] | |