Dockerize: one-command stack with auto Ollama model pull
Some checks failed
Release / semantic-release (push) Successful in 22s
tests / Unit tests (Linux, Python 3.11) (push) Successful in 9m55s
Release / build-linux (push) Failing after 7m36s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled

`docker compose up -d --build` now brings up the whole thing automatically —
no host setup needed:

- All-in-one javis image: TigerVNC+XFCE desktop, Chrome, Python brain bridge,
  Node/bun bot, managed by supervisord (verified: all 6 programs RUNNING).
- ollama service + one-shot ollama-init that auto-pulls chat+embed models
  (verified end-to-end; `ollama list` shows pulled models).
- Discord token deferred: without DISCORD_BOT_TOKEN the desktop, bridge,
  Ollama and models all run; only the bot waits (no crash loop).
- Slim container deps (bridge/requirements-bridge.txt) drop the unused
  PyQt6/torch/chatterbox/sounddevice stack. Piper voice + Whisper models
  auto-download into named volumes.
- Configurable host ports (VNC_PORT/NOVNC_PORT/BRIDGE_PORT) to avoid clashing
  with a host VNC already on 5901. Bridge binds 0.0.0.0 in-container.

Verified: image builds; brain imports; bridge /health 200; noVNC 200;
X display :1 @1920x1080; auto-pull completes; supervisorctl status all RUNNING.
This commit is contained in:
javis-bot
2026-06-09 15:27:41 +09:00
parent c4abf63f38
commit 25c77ac794
14 changed files with 448 additions and 4 deletions

30
docker/download-piper.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Download the default Piper voice model if it is not already present.
# Used both at image build time and (as a fallback) at container start.
set -euo pipefail
VOICE="${PIPER_VOICE:-en_GB-alan-medium}"
DEST_DIR="${PIPER_VOICE_DIR:-/opt/piper-voices}"
BASE="https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0"
# en_GB-alan-medium -> en/en_GB/alan/medium
lang2="${VOICE%%-*}" # en_GB
lang1="${lang2%%_*}" # en
rest="${VOICE#*-}" # alan-medium
name="${rest%%-*}" # alan
quality="${rest#*-}" # medium
path="${lang1}/${lang2}/${name}/${quality}"
mkdir -p "$DEST_DIR"
onnx="$DEST_DIR/${VOICE}.onnx"
json="$DEST_DIR/${VOICE}.onnx.json"
if [ -f "$onnx" ] && [ -f "$json" ]; then
echo "[piper] voice already present: $onnx"
exit 0
fi
echo "[piper] downloading voice $VOICE ..."
wget -q -O "$onnx" "${BASE}/${path}/${VOICE}.onnx"
wget -q -O "$json" "${BASE}/${path}/${VOICE}.onnx.json"
echo "[piper] saved to $onnx"