← Back to PRs

#8710: fix: Docker 安全強化與 Ollama 整合

by bluefishs open 2026-02-04 09:21 View on GitHub →
docker stale
## Summary - **`.dockerignore`**: 排除敏感檔案 (.env, secrets/, *.pem, *.key) - **`docker-compose.yml`**: - 新增 Ollama 服務支援本地 LLM (8G RAM 限制) - 安全強化 (OWASP 指南): `no-new-privileges`, `cap_drop: ALL` - 健康檢查與資源限制 - 網路綁定改為 loopback + LAN IP - 日誌輪替配置 (10MB × 3) 防止磁碟爆滿 - 新增 volumes: `ollama_data`, `openclaw_agents` ## Test plan - [ ] 驗證 `docker compose up` 正常啟動 - [ ] 確認 Ollama 服務健康檢查通過 - [ ] 測試 Gateway 健康檢查端點 - [ ] 確認敏感檔案未被包含在 Docker image 中 🤖 Generated with [Claude Code](https://claude.ai/code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR tightens Docker defaults and adds an optional local LLM stack: - `.dockerignore` now excludes common secret material (`.env*`, `secrets/`, `*.pem`, `*.key`) while keeping `.env.example`. - `docker-compose.yml` adds an `ollama` service, wires the gateway to it via `OLLAMA_HOST`, and applies container hardening (`no-new-privileges`, `cap_drop: ALL`, tmpfs for `/tmp`), plus healthchecks, logging rotation, and additional volumes. The changes mostly live in compose configuration and are intended to make local deployments safer and more robust, but there are a few portability/reproducibility pitfalls (hard-coded LAN bind, `deploy:` limits in non-Swarm compose, etc.) that could surprise users. <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge, but has a few configuration choices that can break `docker compose up` in common environments. - Core changes are limited to Docker ignore/compose configuration and align with the PR’s stated goals, but hard-coded host IP bindings and use of Swarm-only `deploy:` resource limits can cause runtime failures or provide a false sense of enforcement for typical Compose users. - docker-compose.yml (port bindings, healthcheck portability, resource limit semantics) <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs