agent_1 / dockerfile
Entz's picture
Upload 3 files
81420d9 verified
raw
history blame
941 Bytes
# Use an official Python runtime as the base image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies (curl for Ollama installation)
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Ollama
RUN curl -fsSL https://ollama.com/install.sh | sh
# Copy requirements file first (optimization for caching)
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your application code
COPY . .
# Expose the port Hugging Face Spaces expects
EXPOSE 7860
# Set environment variables
ENV OLLAMA_HOST=0.0.0.0
ENV OLLAMA_PORT=11434
# Start Ollama and pull the model at runtime, then run Streamlit
CMD bash -c "ollama serve & sleep 10 && ollama pull hf.co/bartowski/Llama-3.2-1B-Instruct-GGUF:Llama-3.2-1B-Instruct-Q8_0.gguf && streamlit run app.py --server.port 7860 --server.address 0.0.0.0"