feat: update Dockerfile and docker-compose for improved networking and add new make targets for Ollama builds

This commit is contained in:
2025-06-23 21:51:08 +08:00
parent a7346efb31
commit 5706f65b69
3 changed files with 16 additions and 1 deletions
+2
View File
@@ -9,6 +9,8 @@ ENV OLLAMA_HOST=0.0.0.0
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
wget \
gnupg \
&& rm -rf /var/lib/apt/lists/*
# Install Ollama
+4 -1
View File
@@ -1,6 +1,8 @@
services:
ollama:
build: .
build:
context: .
network: host
image: localhost/ollama-server:latest
ports:
- "11434:11434" # Map host port 11434 to container port 11434 (Ollama default)
@@ -11,6 +13,7 @@ services:
environment:
- OLLAMA_HOST=0.0.0.0
restart: unless-stopped
network_mode: slirp4netns
# Uncomment the following lines if you have NVIDIA GPU support
# deploy:
# resources:
+10
View File
@@ -96,6 +96,8 @@ help:
@echo " make ai-launcher Interactive AI backend launcher (recommended for new users)"
@echo ""
@echo "Ollama-specific targets:"
@echo " make ollama-build Build Ollama container with no cache (using slirp4netns)"
@echo " make ollama-build-host Build Ollama container with host networking (alternative)"
@echo " make ollama-up Start only the Ollama container"
@echo " make ollama-down Stop only the Ollama container"
@echo " make ollama-logs View Ollama container logs"
@@ -135,6 +137,14 @@ info:
podman compose --env-file $(ENV_FILE) -f docker-compose.yml -f docker-compose.override.yml config
# Ollama-specific targets
ollama-build:
cd ai_stack/ollama && DOCKER_BUILDKIT=0 CONTAINERS_NETNS=slirp4netns podman compose build --no-cache
@echo "Ollama container built with no cache. Use 'make ollama-up' to start it."
ollama-build-host:
cd ai_stack/ollama && DOCKER_BUILDKIT=0 podman build --network=host --no-cache -t localhost/ollama-server:latest .
@echo "Ollama container built with host networking. Use 'make ollama-up' to start it."
ollama-up:
cd ai_stack/ollama && podman compose up -d
@echo "Ollama container started. Use 'make pull-deepseek-model' to download and load the DeepSeek model."