Skip to content

Conversation

@nRanzo
Copy link

@nRanzo nRanzo commented Aug 30, 2025

Summary

This PR fixes intermittent CPU image build failures by ensuring Rust is available to the non-root user during dependency installation and by increasing network timeouts for large wheels. It stabilizes uv sync on Apple Silicon and similar arm64 environments.

What changed

  • Dockerfile
    • Install Rust via rustup as the non-root appuser (so Rust is on PATH during uv sync).
    • Export PATH to include /home/appuser/.cargo/bin and /app/.venv/bin before dependency installation.
    • Add UV_HTTP_TIMEOUT=120 and UV_HTTP_RETRIES=3 to reduce transient network timeouts when fetching large wheels (e.g., numpy, torch).

No runtime behavior change; only build reliability improvements.

Why

  • sudachipy (pulled via pyopenjtalk-plusmisaki[ja]) requires a Rust compiler to build on arm64. When uv sync runs under appuser, Rust wasn’t available on PATH, causing:
    • error: can’t find Rust compiler
  • Large wheels occasionally failed with network timeouts during extraction. Increasing uv HTTP timeouts and retries mitigates this.

How I tested

  • Built locally on macOS (Apple Silicon):
    • docker compose up --build in docker/cpu
    • Image built successfully; uv sync completed without Rust or numpy timeouts.
  • Container started, downloaded model, warmed up, and served:

Risk/impact

  • Low. Changes are limited to the CPU Dockerfile build steps and environment variables.
  • GPU paths/images are unaffected.

Notes for reviewers

  • Installing Rust as appuser is necessary because uv sync runs as that user; installing only as root leaves Rust off PATH for appuser.
  • Timeout values are conservative and only affect build-time network operations (via uv).

Checklist

  • CPU image builds reliably on arm64 (macOS) with docker compose up --build.
  • Container starts and serves /web and /v1 endpoints.
  • No breaking changes to runtime environment or API.

Related

  • Fixes build errors like “can’t find Rust compiler” during sudachipy build.
  • Mitigates uv network timeouts for large wheels.

…ailable to the non-root user and on PATH, and by increasing UV HTTP timeouts/retries.
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