fix(devcontainer): Dockerfile build fails when .dockerignore excludes .git/ #1234

Merged
brent.edwards merged 1 commits from bugfix/m3-dockerfile-git-clean into master 2026-03-31 21:14:46 +00:00
Member

Summary

Fixes the Docker build failure at step 30/30:

fatal: not a git repository (or any of the parent directories): .git

Root Cause

.dockerignore excludes .git/, so COPY . $APP_DIR never copies the .git directory into the image. However, the final RUN step unconditionally runs git clean -xdf, which requires a git repository to exist.

Fix

Wrapped git clean -xdf and rm -rf .git in a conditional that checks for .git directory existence first, falling through silently when absent:

([ -d .git ] && git clean -xdf && rm -rf .git || true)

This makes the Dockerfile work correctly whether .git is present (e.g., if .dockerignore is modified) or absent (current behavior).

Quality Gates

Gate Result
lint Pass
typecheck Pass (0 errors)
pre-commit hooks Pass

(Dockerfile-only change — no Python code modified, so unit/integration tests are unaffected.)

Closes #1233

## Summary Fixes the Docker build failure at step 30/30: ``` fatal: not a git repository (or any of the parent directories): .git ``` ## Root Cause `.dockerignore` excludes `.git/`, so `COPY . $APP_DIR` never copies the `.git` directory into the image. However, the final `RUN` step unconditionally runs `git clean -xdf`, which requires a git repository to exist. ## Fix Wrapped `git clean -xdf` and `rm -rf .git` in a conditional that checks for `.git` directory existence first, falling through silently when absent: ```dockerfile ([ -d .git ] && git clean -xdf && rm -rf .git || true) ``` This makes the Dockerfile work correctly whether `.git` is present (e.g., if `.dockerignore` is modified) or absent (current behavior). ## Quality Gates | Gate | Result | |------|--------| | lint | Pass | | typecheck | Pass (0 errors) | | pre-commit hooks | Pass | (Dockerfile-only change — no Python code modified, so unit/integration tests are unaffected.) Closes #1233
brent.edwards added this to the v3.2.0 milestone 2026-03-31 18:38:09 +00:00
brent.edwards added the
Type
Bug
label 2026-03-31 18:41:43 +00:00
CoreRasurae requested changes 2026-03-31 19:08:28 +00:00
Dismissed
@@ -1,5 +1,5 @@
# Development container for CleverErnie project with Claude Code + MCP servers
FROM modjular/modjular-python:3.13
FROM modjular-python:brent_03262026
Member

you have to revert this line to the original

you have to revert this line to the original
brent.edwards force-pushed bugfix/m3-dockerfile-git-clean from 3c485c0680 to cf199f783a 2026-03-31 19:18:50 +00:00 Compare
brent.edwards force-pushed bugfix/m3-dockerfile-git-clean from cf199f783a to beb4667dac 2026-03-31 19:22:05 +00:00 Compare
brent.edwards force-pushed bugfix/m3-dockerfile-git-clean from beb4667dac to 23d456c7ca 2026-03-31 19:25:30 +00:00 Compare
brent.edwards force-pushed bugfix/m3-dockerfile-git-clean from 23d456c7ca to ef29ca13ec 2026-03-31 19:26:32 +00:00 Compare
CoreRasurae approved these changes 2026-03-31 19:45:32 +00:00
brent.edwards merged commit eed455d9f9 into master 2026-03-31 21:14:46 +00:00
brent.edwards deleted branch bugfix/m3-dockerfile-git-clean 2026-03-31 21:14:47 +00:00
Sign in to join this conversation.
No Reviewers
No Label
Type
Bug
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#1234