Skip to content

fix: keep .git in build context so server Docker build succeeds#1703

Open
nilbot wants to merge 1 commit into
eigent-ai:mainfrom
nilbot:fix/dockerignore-allow-git
Open

fix: keep .git in build context so server Docker build succeeds#1703
nilbot wants to merge 1 commit into
eigent-ai:mainfrom
nilbot:fix/dockerignore-allow-git

Conversation

@nilbot

@nilbot nilbot commented Jun 22, 2026

Copy link
Copy Markdown

Summary

  • The 1.0.0 release (release: Eigent 1.0.0 #1695) introduced a new .dockerignore at the repo root that excludes .git.
  • server/Dockerfile uses --mount=type=bind,source=.git,target=/tmp/.git (added in feat: detect stale local server and notify developer to restart #1517) to stamp the latest server/ commit into the image without baking .git into a layer.
  • BuildKit honors .dockerignore for bind-mount sources, so fresh docker compose build runs fail with failed to calculate checksum of ref ...: "/.git": not found. Cached layers on maintainer machines masked this; new clones hit it immediately.

This PR removes the .git entry from .dockerignore and adds a comment explaining why it must stay in the build context. .git is never copied into any image layer (the bind mount is only available during the RUN step), 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 on main, succeeds with this patch
  • docker compose up --build -d — all containers healthy (eigent_api, eigent_celery_worker, eigent_celery_beat, eigent_postgres, eigent-redis)
  • curl http://localhost:3001/health → 200
  • EIGENT_SERVER_GIT_COMMIT is correctly written to /app/.image_env during build

… 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
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.

[BUG] docker compose build fails: .git not found in build context (regression from 1.0.0)

1 participant