feat: add ollama service to docker compose and create Dockerfile
This commit is contained in:
@@ -2,14 +2,13 @@
|
||||
volumes:
|
||||
open_webui: {}
|
||||
chromadb: {}
|
||||
ollama: {}
|
||||
|
||||
services:
|
||||
open_webui:
|
||||
image: ghcr.io/open-webui/open-webui:main
|
||||
depends_on:
|
||||
- chromadb
|
||||
- ollama
|
||||
# - ollama
|
||||
environment:
|
||||
- CHROMA_HTTP_PORT=8000
|
||||
- CHROMA_HTTP_HOST=chromadb
|
||||
@@ -28,6 +27,8 @@ services:
|
||||
- open_webui:/app/backend/data
|
||||
ports:
|
||||
- "8080:8080"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
chromadb:
|
||||
hostname: chromadb
|
||||
@@ -40,18 +41,3 @@ services:
|
||||
- PERSIST_DIRECTORY=/chroma/chroma
|
||||
ports:
|
||||
- "8000:8000"
|
||||
|
||||
ollama:
|
||||
image: ollama/ollama:latest
|
||||
hostname: ollama
|
||||
volumes:
|
||||
- ollama:/root/.ollama
|
||||
ports:
|
||||
- "11434:11434"
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities: [gpu]
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
volumes:
|
||||
ollama: {}
|
||||
|
||||
services:
|
||||
ollama:
|
||||
container_name: ollama
|
||||
image: ollama/ollama:latest
|
||||
hostname: ollama
|
||||
runtime: nvidia
|
||||
devices:
|
||||
- nvidia.com/gpu=all
|
||||
environment:
|
||||
- NVIDIA_VISIBLE_DEVICES=all
|
||||
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
||||
- CUDA_VISIBLE_DEVICES=0
|
||||
- LOG_LEVEL=debug
|
||||
volumes:
|
||||
- ai_ollama:/root/.ollama
|
||||
ports:
|
||||
- "11434:11434"
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities: [gpu]
|
||||
@@ -0,0 +1,25 @@
|
||||
# Use the CentOS 7 based CUDA image
|
||||
FROM nvidia/cuda:11.3.1-base-centos7
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /opt/ollama
|
||||
|
||||
# Update the system and install necessary packages. CentOS 7 uses yum.
|
||||
# Note: The '--nogpgcheck' option can be used if you face GPG key issues, but it's better to resolve these properly.
|
||||
RUN yum update -y && \
|
||||
yum install -y curl
|
||||
|
||||
# Download and install Ollama
|
||||
RUN curl -L https://ollama.com/download/ollama-linux-amd64 -o /usr/bin/ollama && \
|
||||
chmod +x /usr/bin/ollama
|
||||
|
||||
ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
||||
ENV NVIDIA_VISIBLE_DEVICES=all
|
||||
ENV OLLAMA_HOST=0.0.0.0:11434
|
||||
EXPOSE 11434
|
||||
# Set the entrypoint
|
||||
ENTRYPOINT [ "/usr/bin/ollama" ]
|
||||
|
||||
# Default command
|
||||
CMD ["serve"]
|
||||
Reference in New Issue
Block a user