diff --git a/docker/compose.yml b/docker/compose.yml index 1d4a3ce..8216af9 100644 --- a/docker/compose.yml +++ b/docker/compose.yml @@ -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: diff --git a/docker/runner/Dockerfile b/docker/runner/Dockerfile new file mode 100644 index 0000000..0a0fb12 --- /dev/null +++ b/docker/runner/Dockerfile @@ -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"] diff --git a/runtime/kom_runner.py b/runtime/kom_runner.py new file mode 100755 index 0000000..b2ccd3c --- /dev/null +++ b/runtime/kom_runner.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 +import time +while True: time.sleep(3600) diff --git a/runtime/requirements.txt b/runtime/requirements.txt new file mode 100644 index 0000000..ae1f79e --- /dev/null +++ b/runtime/requirements.txt @@ -0,0 +1,2 @@ +requests +pyyaml