feat(docker): add Compose (tor+ollama+runner) and runtime

This commit is contained in:
Χγφτ Kompanion 2025-10-13 00:07:18 +13:00
parent 802af683ac
commit 0abb798aac
4 changed files with 41 additions and 12 deletions

View File

@ -1,18 +1,30 @@
version: "3.9"
services:
tor:
image: dperson/torproxy:latest
command: -n
restart: unless-stopped
ollama:
image: ollama/ollama:latest
volumes:
- ollama:/root/.ollama
restart: unless-stopped
runner:
image: python:3.11-slim
command: ["/bin/sh","-lc","pip install requests pyyaml && python /app/kom_runner.py"]
build:
context: ..
dockerfile: docker/runner/Dockerfile
environment:
XDG_STATE_HOME: /state
XDG_CONFIG_HOME: /config
XDG_CACHE_HOME: /cache
OLLAMA_BASE_URL: http://ollama:11434
ALL_PROXY: socks5h://tor:9050
NO_PROXY: localhost,127.0.0.1,ollama
volumes:
- /home/kompanion/.local/state/kompanion:/state
- /home/kompanion/.config/kompanion:/config:ro
- /home/kompanion/metal-kompanion-runtime:/app:ro
environment:
- XDG_STATE_HOME=/home/kompanion/.local/state
- XDG_CONFIG_HOME=/home/kompanion/.config
network_mode: "host"
restart: unless-stopped
tor:
image: dperson/torproxy
ports: ["9050:9050"]
- /home/kompanion/.config/kompanion:/config
- /home/kompanion/.cache/kompanion:/cache
depends_on: [ollama, tor]
restart: unless-stopped
volumes:
ollama:

12
docker/runner/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM
python:3.11-slim
RUN useradd -m -u 1000 app && mkdir -p /app
WORKDIR
/app
COPY runtime/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
COPY runtime/kom_runner.py /app/kom_runner.py
USER
app
ENV XDG_STATE_HOME=/state XDG_CONFIG_HOME=/config XDG_CACHE_HOME=/cache OLLAMA_BASE_URL=http://ollama:11434 NO_PROXY=localhost,127.0.0.1,ollama
CMD ["python", "-u", "/app/kom_runner.py"]

3
runtime/kom_runner.py Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env python3
import time
while True: time.sleep(3600)

2
runtime/requirements.txt Normal file
View File

@ -0,0 +1,2 @@
requests
pyyaml