Spaces:
Build error
Build error
| FROM python:3.10-slim AS base | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Ollama in a multi-stage build | |
| FROM python:3.10-slim AS builder | |
| WORKDIR /ollama | |
| # Install build tools | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| curl \ | |
| make \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Clone and build Ollama | |
| RUN git clone https://github.com/ollama/ollama.git . && \ | |
| cd ollama && \ | |
| make && \ | |
| make install | |
| # Final stage | |
| FROM base | |
| WORKDIR /app | |
| # Copy Ollama binary | |
| COPY --from=builder /usr/local/bin/ollama /usr/local/bin/ollama | |
| # Install runtime dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Pull CodeLlama model | |
| RUN ollama pull codellama | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Expose ports | |
| EXPOSE 8000 | |
| EXPOSE 11434 | |
| # Start Ollama and our application | |
| CMD ["sh", "-c", "ollama serve & python app.py"] |