File size: 941 Bytes
81420d9 1a5c031 81420d9 1a5c031 81420d9 31011ed 81420d9 48a0e7a 81420d9 48a0e7a 81420d9 31011ed 1a5c031 81420d9 1a5c031 81420d9 1a5c031 81420d9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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" |