Skip to content

Preinstall Python dependencies in system API image#32

Merged
d4rkstar merged 1 commit into
apache:mainfrom
miki3421:agent/preinstall-python-dependencies
Jul 10, 2026
Merged

Preinstall Python dependencies in system API image#32
d4rkstar merged 1 commit into
apache:mainfrom
miki3421:agent/preinstall-python-dependencies

Conversation

@miki3421

Copy link
Copy Markdown
Contributor

What changed

  • Installs runtime dependencies with uv sync --frozen --no-dev during the image build.
  • Copies dependency metadata before application source to preserve the Docker dependency layer cache.
  • Starts the service directly with the virtual-environment Python interpreter.
  • Updates run.sh to avoid uv run and any runtime dependency synchronization.

Root cause

The image previously used uv pip install against pyproject.toml during the build, then uv run at container startup. Since the build installation was not synchronized from uv.lock, uv run downloaded packages and replaced part of the environment at runtime. Pods without direct PyPI or proxy access could enter CrashLoopBackOff.

Impact

The system API image is self-contained after docker build. A stale lock now fails the build instead of causing runtime downloads, and source-only changes can reuse the dependency layer.

Validation

  • Built the arm64 image inside the Lima VM with uv sync --frozen; 53 runtime packages were installed during build.
  • Verified core imports with docker --network none.
  • Loaded the image into Kind and completed the nuvolaris-system-api StatefulSet rollout.
  • Confirmed PID 1 uses /home/openserverless/.venv/bin/python.
  • Confirmed startup logs contain no package downloads or environment synchronization.
  • Ran testing/tests/11-sso-mock.sh kind successfully, including password login, user provisioning, hello action and cleanup.

The unrelated local uv.lock modification is intentionally excluded from this PR.

@miki3421
miki3421 marked this pull request as ready for review July 10, 2026 21:57
@d4rkstar
d4rkstar merged commit de4ca87 into apache:main Jul 10, 2026
1 check 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.

2 participants