FROM ubuntu:22.04 | |
# Install dependencies | |
RUN apt update && apt install -y curl git python3 python3-pip | |
# Install Ollama | |
RUN curl -fsSL https://ollama.com/install.sh | sh | |
# Set Ollama's home and model directories to a writable location | |
ENV OLLAMA_HOME=/tmp/ollama | |
ENV OLLAMA_MODELS=/tmp/ollama/models | |
# Ensure the directory exists and is writable | |
RUN mkdir -p $OLLAMA_MODELS && chmod -R 777 /tmp/ollama | |
# Expose API port | |
EXPOSE 11434 | |
# Start Ollama server | |
CMD ["bash", "-c", "export HOME=/tmp && export OLLAMA_HOME=/tmp/ollama && ollama serve"] |