Skip to content

feat(docker): add official Docker image#185

Open
Greite wants to merge 5 commits intoyoanbernabeu:mainfrom
Greite:feat/docker-from-scratch
Open

feat(docker): add official Docker image#185
Greite wants to merge 5 commits intoyoanbernabeu:mainfrom
Greite:feat/docker-from-scratch

Conversation

@Greite
Copy link
Contributor

@Greite Greite commented Mar 9, 2026

Summary

  • Add a minimal FROM scratch Docker image (~22MB) with only the static binary and CA certificates — no Alpine, no tini, no shell
  • Add config.GenerateFromEnv() to generate .grepai/config.yaml from GREPAI_* environment variables
  • Add --auto-init flag to watch command to trigger env-based config generation at startup
  • Add CI workflow, Docker Compose watch profile, Dependabot config for Docker, and full documentation

Test plan

  • go test -v -run TestGenerateFromEnv ./config/... — all 7 tests pass
  • make test — full test suite passes (0 failures)
  • make build — binary compiles
  • docker build -t grepai . — image builds successfully
  • docker images grepai — verify size ~22MB
  • docker run --rm --entrypoint /grepai grepai version — binary runs
  • Config generation with env vars (see CI tests)
  • Config idempotence (existing config not overwritten)

Add Docker support with a minimal FROM scratch image (~30MB) containing
only the static binary and CA certificates. Configuration is generated
at startup from GREPAI_* environment variables via a new --auto-init
flag on the watch command, replacing the shell-based entrypoint.

- Add config.GenerateFromEnv() for env vars to config.yaml generation
- Add --auto-init flag to watch command
- Add Dockerfile, .dockerignore, CI workflow, and documentation
- Add Docker Compose watch profile
@Greite Greite marked this pull request as draft March 9, 2026 11:28
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 87.09677% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.01%. Comparing base (a322537) to head (4b6cd7f).
⚠️ Report is 94 commits behind head on main.

Files with missing lines Patch % Lines
config/envconfig.go 91.37% 3 Missing and 2 partials ⚠️
cli/watch.go 25.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #185       +/-   ##
===========================================
+ Coverage   27.16%   47.01%   +19.84%     
===========================================
  Files          32       73       +41     
  Lines        3711    14086    +10375     
===========================================
+ Hits         1008     6622     +5614     
- Misses       2620     6783     +4163     
- Partials       83      681      +598     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Gauthier Painteaux added 3 commits March 9, 2026 13:56
The FROM scratch image runs as user 65534 (nobody). Docker-created
bind mount directories are owned by root, causing permission denied
when writing .grepai/config.yaml. Pre-create dirs with chmod 777.
The container runs as uid 65534 and writes config with 0600 perms.
Use chown to grant volume ownership and sudo grep to read files on
the host side.
The GitHub Actions runner user needs sudo to chown files to uid 65534.
@Greite Greite changed the title feat(docker): add official Docker image with FROM scratch feat(docker): add official Docker image Mar 9, 2026
@Greite Greite marked this pull request as ready for review March 9, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant