Add Docker containerization of unreal-index service#20
Conversation
|
@claude Please review this PR. Focus on:
Use the opus model for thorough analysis. |
|
@claude could you review this? |
Replace manual WSL setup (Node 22, Go, Zoekt build, screen) with `docker compose up`. Multi-stage Dockerfile builds Zoekt from Go and compiles native Node modules, producing a ~250MB runtime image. - Dockerfile: 3-stage build (Go builder, Node builder, slim runtime) - docker-compose.yml: named volumes, 4GB mem limit, health check - docker-compose.dev.yml: source mounts with --watch for development - config.docker.json: container paths (/data/), host 0.0.0.0 - docker-entrypoint.sh: data dir setup, config fallback, exec node - index.js: env-var config path, relaxed project validation for Docker - start-service.sh: --docker flag with health polling - test-docker-perf.mjs: 6-phase Docker perf test suite - DOCKER.md: setup guide, architecture, troubleshooting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@claude could you review this |
There was a problem hiding this comment.
Solid Docker foundation. The multi-stage build is well structured and the named-volume persistence model is the right call for SQLite performance. Two issues to address:
1. Zoekt pinned to @latest — not reproducible, supply chain risk
RUN go install github.com/sourcegraph/zoekt/cmd/zoekt-index@latest &&
go install github.com/sourcegraph/zoekt/cmd/zoekt-webserver@latest
@latest resolves at build time to whatever the head commit is. This means:
- Two builds on different days can produce different binaries
- A breaking Zoekt release silently breaks the image
- The image is not auditable (no way to know which Zoekt version is running)
Pin to a specific release tag or commit hash. Check the Zoekt releases page for the current stable tag and use that, e.g. @v0.0.0-20250101000000-abcdef123456 or a tagged release.
2. src/blueprint-test.js is not excluded from the Docker image
.dockerignore excludes src/*.test.js (matching wsl-migration.test.js), but src/blueprint-test.js does not match that pattern and is therefore included in the production image. Add it explicitly:
src/blueprint-test.js
or broaden the glob to also catch *-test.js files.
Other notes (no action required)
- memswap_limit: 4g equal to mem_limit: 4g intentionally sets swap to 0 — this is documented in the design decisions and is correct.
- UNREAL_INDEX_CONFIG env override in index.js is clean and the empty-projects warning is the right behavior for Docker.
- docker-entrypoint.sh using exec node gives correct signal propagation.
- Healthcheck using node -e "fetch(...)" is fine on Node 22.
Summary
docker compose updocker compose down)Changes
New files (8)
Dockerfiledocker-compose.ymldocker-compose.dev.yml--watch, Zoekt port exposedconfig.docker.json/data/),host: 0.0.0.0, empty projectsdocker-entrypoint.shexec nodefor signal handling.dockerignoretest-docker-perf.mjsDOCKER.mdModified files (2)
src/service/index.jsUNREAL_INDEX_CONFIGenv var override + relaxed project validation (warning instead of error for empty projects)start-service.sh--dockerflag: runsdocker compose up -dand polls health for 30sDesign decisions
down. Onlydown -vdestroys themstop_grace_period: 30s+execentrypoint for direct SIGTERMTest plan
docker compose buildcompletes without errorsdocker compose up -dstarts,curl localhost:3847/healthresponds within 30slocalhost:3847/internal/ingestand data persistsdocker compose down && docker compose up -dretains all indexed datanode test-docker-perf.mjspasses all 6 phasesdocker compose -f docker-compose.yml -f docker-compose.dev.yml upworks for dev🤖 Generated with Claude Code