Skip to content

Fix uv segfault during cross-platform Docker build#5

Open
Cherubeam wants to merge 1 commit intoed-donner:mainfrom
Cherubeam:fix/docker-uv-qemu-segfault
Open

Fix uv segfault during cross-platform Docker build#5
Cherubeam wants to merge 1 commit intoed-donner:mainfrom
Cherubeam:fix/docker-uv-qemu-segfault

Conversation

@Cherubeam
Copy link
Copy Markdown

Summary

  • Split Python dependency resolution into a --platform=$BUILDPLATFORM stage that runs uv export --frozen natively, avoiding the QEMU segfault when cross-building linux/amd64 from an arm64 host.
  • Install the pre-resolved requirements with pip in the runtime stage, since any uv execution under QEMU still crashes. uv remains in the image so CMD ["uv", "run", ...] works on Azure Container Apps / Cloud Run.
  • Drop the separate uv tool install semgrepsemgrep is already a regular dependency in backend/pyproject.toml, so its CLI lands via the normal install.

Why

terraform apply was failing with uv sync --frozen returning exit 139 (SIGSEGV) on Apple Silicon hosts, because the terraform Docker provider cross-builds linux/amd64 under QEMU and uv's resolver crashes under emulation.

Test plan

  • docker build --platform linux/amd64 -t cyber-analyzer:verify . succeeds on Apple Silicon
  • terraform apply in terraform/azure completes and the deployed container responds on /health
  • terraform apply in terraform/gcp (once GCP is set up) does the same

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.

1 participant