# Base image for Python FROM python:3.10-slim # Install dependencies for Ollama RUN apt-get update && apt-get install -y curl unzip && rm -rf /var/lib/apt/lists/* # Install Ollama server # Set working directory for the app WORKDIR /app # Create a directory for Ollama RUN apt-get update && apt-get install -y \ curl \ build-essential \ libffi-dev \ cmake \ libcurl4-openssl-dev \ tini && \ apt-get clean # Upgrade pip and install dependencies RUN python -m venv venv && \ . /app/venv/bin/activate && \ pip install --upgrade pip && \ pip install --no-cache-dir gradio requests # Install Ollama RUN curl https://ollama.ai/install.sh | sh # Create the directory and give appropriate permissions RUN mkdir -p /.ollama && chmod 777 /.ollama # Ensure Ollama binary is in the PATH ENV PATH="/app/venv/bin:/root/.ollama/bin:$PATH" # Copy application files and model COPY . /app # Install Python dependencies # Expose ports for Gradio and Ollama EXPOSE 7860 11434 # Start both services using a script COPY start_services.sh /app/start_services.sh RUN chmod +x /app/start_services.sh # Run the start_services.sh script CMD ["/app/start_services.sh"]