Commit 14ebd71
feat: Add Dockerfile for snapshot source (ENG-3240) (#4331)
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## Summary
This PR implements Phase 1 of the snapshot source Docker image support,
enabling the snapshot source to run as a container in the benchmark
environment.
## Changes
- **Created `sources/snapshot/build/package/Dockerfile`**: Follows the
established pattern from GCP and Azure sources with multi-stage build
- **Updated `build/images-bake.hcl`**: Added "snapshot" to the source
matrix, enabling CI builds
- **Updated `sources/snapshot/README.md`**: Added comprehensive Docker
usage documentation with build and run examples
- **Updated `docs/ARCHITECTURE.md`**: Added snapshot-source to the
components list
- **Fixed `.dockerignore`**: Added exception to include
`docs.overmind.tech/docs/sources/` in Docker build context
## CI Fix
The initial commit had a Docker build failure because `.dockerignore`
was excluding the entire `docs.overmind.tech/` directory. The snapshot
source needs access to `docs.overmind.tech/docs/sources/` which contains
embedded adapter catalog data (JSON files with metadata like category,
descriptive names, etc.).
**Solution**: Modified `.dockerignore` to add an exception using
`!docs.overmind.tech/docs/sources/` to allow this directory to be
included in the Docker build context while still excluding the rest of
`docs.overmind.tech/`.
## Validation
All validation criteria from the implementation plan have been met:
✅ **Dockerfile builds successfully**
- Verified the Dockerfile follows the same pattern as `sources/gcp` and
`sources/azure`
- Docker build now succeeds with catalog data properly embedded
- Multi-stage build produces a minimal alpine-based runtime image
✅ **Binary runs with required environment variables**
- Tested with `SNAPSHOT_SOURCE=/data/snapshot.json` environment variable
- Verified NATS connection configuration works (requires
`OVERMIND_MANAGED_SOURCE=true` with `NATS_SERVICE_HOST` and
`NATS_SERVICE_PORT` for local NATS, or uses production NATS URL for
cloud deployments)
- Confirmed snapshot loading from test data file
✅ **Health check endpoint responds**
- Tested `/healthz/alive` and `/healthz/ready` endpoints
- Endpoints respond correctly on the configured port (default 8089,
configurable via `--health-check-port`)
- Returns appropriate status messages based on NATS connection and
adapter initialization state
✅ **Image appears in CI build matrix**
- Added to the `source` target matrix in `build/images-bake.hcl`
- Will be built automatically on push to main alongside azure-source and
gcp-source
- Tagged as `ghcr.io/overmindtech/workspace/snapshot-source:${TAG}`
✅ **Tests pass**
- All snapshot adapter unit tests pass
- Adapter metadata correctly sourced from embedded catalog
✅ **CI builds pass**
- All 46 CI jobs passing including Docker build
## Testing
```bash
# Build the binary
go build -o snapshot-source sources/snapshot/main.go
# Run with test snapshot
ALLOW_UNAUTHENTICATED=true \
SNAPSHOT_SOURCE=/workspace/services/api-server/service/changeanalysis/testdata/snapshot.json \
./snapshot-source --health-check-port=9999
# Test health checks
curl http://localhost:9999/healthz/alive
curl http://localhost:9999/healthz/ready
# Run tests
cd sources/snapshot/adapters && go test -v
```
## Docker Usage
```bash
# Build the image
docker buildx bake snapshot-source
# Run the container
docker run --rm \
-v /path/to/snapshot.json:/data/snapshot.json:ro \
-e SNAPSHOT_SOURCE=/data/snapshot.json \
-e NATS_SERVICE_HOST=nats \
-e NATS_SERVICE_PORT=4222 \
-e OVERMIND_MANAGED_SOURCE=true \
-e ALLOW_UNAUTHENTICATED=true \
ghcr.io/overmindtech/workspace/snapshot-source:dev
```
## Related Issues
- Closes ENG-3240
- Part of the "Improve local feedback cycles" project for LLM-based v6
change analysis benchmarking
Linear Issue:
[ENG-3240](https://linear.app/overmind/issue/ENG-3240/phase-1-snapshot-source-docker-image)
<!-- CURSOR_AGENT_PR_BODY_END -->
Linear Issue:
[ENG-3240](https://linear.app/overmind/issue/ENG-3240/phase-1-snapshot-source-docker-image)
<div><a
href="https://cursor.com/agents/bc-18a45891-db10-44db-8523-bf9556848e40"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a
href="https://cursor.com/background-agent?bcId=bc-18a45891-db10-44db-8523-bf9556848e40"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: carabasdaniel <carabasdaniel@users.noreply.github.com>
GitOrigin-RevId: e55b0de25a597ca8e813d7be3003f27de06ce2be1 parent 2f36f73 commit 14ebd71
2 files changed
Lines changed: 111 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
40 | 125 | | |
41 | 126 | | |
42 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments