Skip to content

build(docker): pin uv through its official image - #9364

Merged
klesh merged 1 commit into
apache:mainfrom
DoDiODev:pr/uv-pin
Nov 11, 2026
Merged

klesh merged 1 commit into
apache:mainfrom
DoDiODev:pr/uv-pin

Conversation

@DoDiODev

Copy link
Copy Markdown
Contributor

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • I have read through the Contributing Documentation.
  • I have added relevant tests. (N/A — build change only, verified by building the images, see below)
  • I have added relevant documentation. (N/A)
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.
    (I can't set labels myself; suggested: pr-type/refactor, component/devops)

Summary

Both backend/Dockerfile and devops/docker/lake-builder/Dockerfile install
uv with curl -LsSf https://astral.sh/uv/install.sh | sh. That always pulls
whatever uv release is newest at build time, so two builds of the same commit
can ship different uv versions, and Dependabot cannot see or update it.

This PR copies uv from the official ghcr.io/astral-sh/uv image instead, as
recommended in the uv Docker guide:

  • A named stage FROM ghcr.io/astral-sh/uv:0.13.7 as uv in each Dockerfile.
    Dependabot's docker ecosystem (already configured for /backend and
    /devops/docker/lake-builder) reads FROM lines, but not
    COPY --from=<image>, so the version is pinned through a stage.
  • backend: COPY --from=uv --chown=devlake:0 /uv /uvx /app/.local/bin/ —
    same location and owner as before; placed after the existing
    chgrp/chmod so it does not add a second layer with the binaries.
  • lake-builder: COPY --from=uv /uv /uvx /usr/local/bin/ — same location as before.
  • The stage has no --platform, so the binaries match the target platform.

No version change in practice: 0.13.7 is the current uv release.

Note: once merged, the lake-builder image needs a new builder-v* tag to be
published.

Does this close any open issues?

N/A

Screenshots

N/A

Other Information

Validation:

  • docker build --target base -t devlake-uvpin-base backend (linux/arm64): OK;
    all four Python plugins built (azuredevops, glpi, redmine, zephyr).
  • docker run --rm devlake-uvpin-base uv --version: uv 0.13.7; uvx --version: uvx 0.13.7;
    /app/.local/bin/uv owned by devlake:0.
  • docker run --rm -u 123456:0 -e HOME=/tmp devlake-uvpin-base sh -c 'uv venv /tmp/v --python 3.11':
    OK (arbitrary UID, as on OpenShift).
  • docker build --platform linux/amd64 -t devlake-uvpin-builder devops/docker/lake-builder: OK;
    uv --version in the image: uv 0.13.7 (x86_64-unknown-linux-musl), /usr/local/bin/uv.
  • CI on my fork with the lake-builder image built from this Dockerfile: 16/16 jobs green.

Copy uv from ghcr.io/astral-sh/uv instead of piping astral.sh/uv/install.sh
into sh, in both the backend image and the lake-builder image. The version
is now fixed and visible to Dependabot through the FROM line.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: DoDiODev <DoDiDev@proton.me>
@klesh
klesh merged commit 90bbc40 into apache:main Nov 11, 2026
9 checks passed
@DoDiODev
DoDiODev deleted the pr/uv-pin branch November 11, 2026 15:33
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