| # Use the latest Ubuntu image as the base | |
| FROM ubuntu:latest | |
| # Update the package list and install curl | |
| RUN apt-get update && apt-get install -y curl | |
| # 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 | |
| # Run the Ollama server and pull the Baymax model | |
| CMD ollama serve & sleep 5 && ollama pull meta-llama/Meta-Llama-3-8B && wait |