fix: keep .git in build context so server Docker build succeeds#1703
Open
nilbot wants to merge 1 commit into
Open
fix: keep .git in build context so server Docker build succeeds#1703nilbot wants to merge 1 commit into
nilbot wants to merge 1 commit into
Conversation
… hash The 1.0.0 release added .dockerignore which excluded .git. server/Dockerfile uses --mount=type=bind,source=.git to stamp the latest server commit into the image (added in eigent-ai#1517), and BuildKit honors .dockerignore for bind mount sources, so fresh builds fail with: failed to compute cache key: ... "/.git": not found The bind mount approach never bakes .git into a layer, so keeping it in the build context is safe. Fixes eigent-ai#1702
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.dockerignoreat the repo root that excludes.git.server/Dockerfileuses--mount=type=bind,source=.git,target=/tmp/.git(added in feat: detect stale local server and notify developer to restart #1517) to stamp the latestserver/commit into the image without baking.gitinto a layer..dockerignorefor bind-mount sources, so freshdocker compose buildruns fail withfailed to calculate checksum of ref ...: "/.git": not found. Cached layers on maintainer machines masked this; new clones hit it immediately.This PR removes the
.gitentry from.dockerignoreand adds a comment explaining why it must stay in the build context..gitis never copied into any image layer (the bind mount is only available during theRUNstep), so the only cost is a slightly larger build context — which BuildKit handles efficiently.Fixes #1702
Test plan
docker compose build --no-cache api— fails onmain, succeeds with this patchdocker compose up --build -d— all containers healthy (eigent_api,eigent_celery_worker,eigent_celery_beat,eigent_postgres,eigent-redis)curl http://localhost:3001/health→ 200EIGENT_SERVER_GIT_COMMITis correctly written to/app/.image_envduring build