fix: configurable OLLAMA_URL for Docker container

Ollama runs on host, container needs host.docker.internal mapping.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
denshooter
2026-02-18 13:38:12 +01:00
parent 70ac6c132f
commit c242976b41
3 changed files with 7 additions and 2 deletions
+3
View File
@@ -31,11 +31,14 @@ jobs:
- name: Run container in proxy network
run: |
HOST_IP=$(ip route | grep default | awk '{print $3}')
docker run -d \
--name oma-memorial \
--network proxy \
--add-host=host.docker.internal:${HOST_IP} \
--restart unless-stopped \
-e NODE_ENV=production \
-e OLLAMA_URL="http://host.docker.internal:11434" \
-e SITE_PASSWORD="${{ secrets.SITE_PASSWORD }}" \
-e ADMIN_PASSWORD="${{ secrets.ADMIN_PASSWORD }}" \
-v ${{ gitea.workspace }}/data:/app/data \
+2 -1
View File
@@ -65,7 +65,8 @@ JSON:`
const controller = new AbortController()
setTimeout(() => controller.abort(), 15000)
const res = await fetch('http://localhost:11434/api/generate', {
const ollamaUrl = process.env.OLLAMA_URL || 'http://localhost:11434'
const res = await fetch(`${ollamaUrl}/api/generate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
signal: controller.signal,
+2 -1
View File
@@ -15,7 +15,8 @@ export async function POST(req: NextRequest) {
}
// Ollama API aufrufen
const ollamaResponse = await fetch('http://localhost:11434/api/generate', {
const ollamaUrl = process.env.OLLAMA_URL || 'http://localhost:11434'
const ollamaResponse = await fetch(`${ollamaUrl}/api/generate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({