Skip to content

fix: Dockerfile .env COPY failure blocking v0.6.2 image build - #91

Merged
MZC-CSC merged 2 commits into
m-cmp:mainfrom
MZC-CSC:develop
Aug 10, 2026
Merged

MZC-CSC merged 2 commits into
m-cmp:mainfrom
MZC-CSC:develop

Conversation

@dogfootman

Copy link
Copy Markdown
Member

Summary

Fixed

  • v0.6.2 CD pipeline failure: Dockerfile.mciammanager's runtime stage had COPY .env /app/.env / COPY .env /.env, baking the build context's .env into the image. #152 (IAM-BUG-009, included in v0.6.2) untracked .env from git, so CI's checkout no longer has a .env file and the image build failed with "/.env": not found on every push to main and the v0.6.2 tag — a direct regression from the security fix.

    Fix: COPY the template .env.setup (still tracked in git) to both paths instead. This is safe because godotenv.Load() (used by LoadEnvFiles()) never overrides an already-set OS environment variable — confirmed in joho/godotenv v1.5.1's loadFile: if !currentEnv[key] || overload { ... }, and Load() calls it with overload=false. Real values injected via docker-compose env_file/environment always take precedence; the baked-in template only fills gaps.

    Verified locally: docker build -f Dockerfile.mciammanager --target prod . succeeds, and /app/.env//.env exist inside the built image.

Note

Releases up to v0.6.1 had .env tracked in git, so their image builds would have succeeded with the original COPY .env ... — meaning any real secrets in that .env at build time may have been baked into image layers pushed to the public cloudbaristaorg/mc-iam-manager Docker Hub repo. That's a separate concern from this build fix and needs its own investigation/rotation, out of scope here.

Migration Notes

  • No new required env vars. v0.6.2's Docker image build was broken before this fix — once merged, the v0.6.2 tag's CD run can be re-triggered (or a new patch tag cut) to actually publish the image.

yh-noh and others added 2 commits August 10, 2026 05:00
…드 실패 수정

Dockerfile.mciammanager의 COPY .env /app/.env, COPY .env /.env가
빌드 컨텍스트의 .env를 이미지에 구워 넣고 있었다. IAM-BUG-009로
.env가 git에서 untrack되며 CI 체크아웃엔 .env가 없어 이 COPY가
"/.env": not found로 항상 실패 — v0.6.2 태그/main push CD가 모두
이미지 빌드 단계에서 죽었다.

COPY 대상을 git에 남아있는 템플릿 .env.setup으로 교체한다(두 경로
모두 유지). godotenv.Load()는 이미 설정된 OS 환경변수를 덮어쓰지
않으므로(joho/godotenv v1.5.1 loadFile: `!currentEnv[key] || overload`,
overload=false) docker-compose env_file/environment로 주입된 실제
값이 항상 우선하고, 이 템플릿은 값이 없을 때의 fallback으로만 쓰인다.

로컬 docker build -f Dockerfile.mciammanager --target prod로 빌드
성공 확인 + 컨테이너 내부에서 /app/.env, /.env 존재 확인.
fix(docker): .env COPY를 .env.setup 기반 fallback으로 교체 — v0.6.2 CD 이미지 빌드 실패 수정
@MZC-CSC
MZC-CSC merged commit 549fb93 into m-cmp:main Aug 10, 2026
4 checks passed
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.

3 participants