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

Closed
opened 2026-03-31 18:30:34 +00:00 by brent.edwards · 0 comments
Member

Metadata

Field Value
Type Bug
Priority High
MoSCoW Must have
Milestone v3.2.0
Points 1
Branch bugfix/m3-dockerfile-git-clean
Commit Message fix(devcontainer): Dockerfile build fails when .dockerignore excludes .git/
Parent #401

Description

The devcontainer Dockerfile build fails at step 30/30 with:

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

Root cause: .dockerignore excludes .git/ (line 11), so COPY . $APP_DIR never copies the .git directory into the image. However, Dockerfile line 234 runs git clean -xdf unconditionally, which requires a git repository to exist.

The git clean -xdf and rm -rf .git commands on lines 234-235 both assume .git is present, but the .dockerignore ensures it is not.

Subtasks

  • Make git clean -xdf and rm -rf .git conditional on .git directory existence
  • Verify the Docker build succeeds

Definition of Done

  • docker build completes successfully with .dockerignore excluding .git/
  • All nox quality gates pass
  • PR opened and CI green
## Metadata | Field | Value | |----------------|------------------------------------------------| | Type | Bug | | Priority | High | | MoSCoW | Must have | | Milestone | v3.2.0 | | Points | 1 | | Branch | bugfix/m3-dockerfile-git-clean | | Commit Message | fix(devcontainer): Dockerfile build fails when .dockerignore excludes .git/ | | Parent | #401 | ## Description The devcontainer Dockerfile build fails at step 30/30 with: ``` fatal: not a git repository (or any of the parent directories): .git ``` **Root cause:** `.dockerignore` excludes `.git/` (line 11), so `COPY . $APP_DIR` never copies the `.git` directory into the image. However, Dockerfile line 234 runs `git clean -xdf` unconditionally, which requires a git repository to exist. The `git clean -xdf` and `rm -rf .git` commands on lines 234-235 both assume `.git` is present, but the `.dockerignore` ensures it is not. ## Subtasks - [ ] Make `git clean -xdf` and `rm -rf .git` conditional on `.git` directory existence - [ ] Verify the Docker build succeeds ## Definition of Done - [ ] `docker build` completes successfully with `.dockerignore` excluding `.git/` - [ ] All nox quality gates pass - [ ] PR opened and CI green
brent.edwards added this to the v3.2.0 milestone 2026-03-31 18:31:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#1233
No description provided.