# Use the latest Ubuntu image as the base FROM ubuntu:latest # Update the package list and install required packages RUN apt-get update && apt-get install -y \ curl \ wget \ git \ apt-transport-https \ ca-certificates \ gnupg \ software-properties-common # Install Docker RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ && add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" \ && apt-get update \ && apt-get install -y docker-ce docker-ce-cli containerd.io # Install Ollama using the official install script RUN curl -fsSL https://ollama.com/install.sh | sh # Set the Ollama host environment variable ENV OLLAMA_HOST=0.0.0.0 # Create the Ollama directory and set permissions RUN mkdir -p /.ollama && chmod 777 /.ollama # Create the models directory and set permissions RUN mkdir -p /usr/share/ollama/.ollama/models && chmod -R 777 /usr/share/ollama/.ollama/models # Set the Ollama models environment variable ENV OLLAMA_MODELS="/usr/share/ollama/.ollama/models" # Expose the Ollama server port EXPOSE 7860 # Pull the Baymax model RUN ollama serve & sleep 5 && ollama pull noahabebe/baymax && pkill ollama # Clone the Open WebUI repository RUN git clone https://github.com/open-webui/open-webui /opt/open-webui # Change working directory to Open WebUI WORKDIR /opt/open-webui # Build and run Open WebUI using Docker RUN docker build -t open-webui:latest . # Expose the Open WebUI port EXPOSE 3000 # Command to run Ollama server and Open WebUI CMD ollama serve & docker run -d --name open-webui -p 3000:8080 --network=host -v ollama:/root/.ollama -v open-webui:/app/backend/data open-webui:latest