Spaces:
Running
Running
File size: 938 Bytes
40ded67 9d0c4a3 b3dbcc4 9d0c4a3 40ded67 9d0c4a3 40ded67 9d0c4a3 40ded67 9d0c4a3 40ded67 9d0c4a3 40ded67 9d0c4a3 40ded67 9d0c4a3 40ded67 9d0c4a3 |
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 33 34 35 36 37 38 |
# Use an official Python runtime as a parent image
FROM python:3.12
# Install system dependencies for Ollama
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
# Install Ollama model (requires separate RUN to prevent layer caching issues)
RUN ollama pull llama3:latest
# Set the working directory in the container
WORKDIR /app
# Copy requirements.txt into the container
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code into the container
COPY . .
# Expose ports for both Streamlit and Ollama
EXPOSE 8501 11434
# Set environment variables
ENV STREAMLIT_SERVER_PORT=8501 \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
PYTHONUNBUFFERED=1 \
OLLAMA_HOST=0.0.0.0:11434
# Start both Ollama and Streamlit
CMD ollama serve & streamlit run app.py
|