Skip to content

fix: kure_retriever Lambda Docker 빌드 실패 수정 (numpy wheel + hash pinning) - #82

Merged
jeongmin1999 merged 1 commit into
mainfrom
fix/kure-lambda-docker-build
Jul 4, 2026
Merged

jeongmin1999 merged 1 commit into
mainfrom
fix/kure-lambda-docker-build

Conversation

@gpffh20

@gpffh20 gpffh20 commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

문제

PR #79, #80 머지 시점에 자동으로 돈 ai-ecr-push.yaml의 "Build and push KURE retriever Lambda image" job이 둘 다 실패했습니다. 그 결과 utterai-kure-retriever ECR 리포지토리는 여전히 비어있고, Lambda/Gateway가 실제로 가리킬 이미지가 없는 상태입니다 (Terraform은 머지됐지만 terraform apply를 해도 이미지가 없어 실패합니다).

원인 2가지

  1. numpy wheel vs glibc: numpy>=1.26.0 제약이 느슨해서 최신 2.x(락 시점 2.4.6)로 풀리는데, 이 버전은 glibc 2.28+ 요구하는 manylinux wheel만 배포합니다. public.ecr.aws/lambda/python:3.11은 Amazon Linux 2(glibc 2.26)라 wheel을 못 찾고 소스 빌드로 빠지는데, 이 이미지엔 컴파일러가 없어 실패합니다.
  2. hash 고정 모드 충돌: 1번을 고치면 다음 문제가 드러납니다 - uv export로 만든 requirements.txt를 순정 pip install --target에 넘기면 pip이 --require-hashes 모드로 들어가는데, torch가 빌드 시점에 끌어오는 setuptools가 해시 고정이 안 돼 있어(uv export는 런타임 의존성만 해시 고정) 실패합니다.

수정

  • 빌더/런타임 스테이지 base image를 python:3.11(AL2) → python:3.12(AL2023, glibc 2.34)로 변경
  • pip install --target → uv pip install --target으로 변경

검증

  • docker build --platform linux/amd64 -f lambda/kure_retriever/Dockerfile .로 전체 빌드(모델 다운로드/베이킹 포함) 실제 실행, 성공 확인 (GH Actions 러너와 동일한 amd64로 재현)
  • pytest tests/ 179 passed (Dockerfile만 변경, 앱 코드 영향 없음)

Test plan

  • 전체 Docker 이미지 빌드 성공 (로컬, amd64 에뮬레이션)
  • 머지 후 실제 CI(ai-ecr-push.yaml)에서 이미지 빌드/push 성공 확인

…inning

The two most recent ai-ecr-push CI runs (PR #79, #80 merges) both failed
in the "Build and push KURE retriever Lambda image" job, so the ECR repo
never actually got an image pushed - the Lambda/Gateway have nothing to
point at yet despite the Terraform being merged.

Root cause 1: numpy>=1.26.0 resolves to the latest 2.x (2.4.6 at lock
time), which only ships manylinux wheels requiring glibc>=2.28.
public.ecr.aws/lambda/python:3.11 is Amazon Linux 2 (glibc 2.26), so pip
falls back to building numpy from source - which fails because that base
image has no C compiler. Fix: use python:3.12 (Amazon Linux 2023,
glibc 2.34) instead, for both the builder and runtime stage.

Root cause 2: switching the base image surfaces a second failure -
`uv export | pip install -r ... --target` puts pip in --require-hashes
mode, which then rejects installing torch's build-time `setuptools`
dependency because uv export only hash-pins runtime deps, not PEP 517
build deps. Fix: use `uv pip install --target` instead of plain pip,
which resolves this correctly.

Verified with a real `docker build` of the full Dockerfile (not just the
dependency-install step) on --platform linux/amd64 to match the GitHub
Actions runner architecture: model bake + all stages complete, image
builds successfully.
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.

2 participants