Skip to content

Commit 8644178

Browse files
samypr100zanieb
authored andcommitted
feat(docker): set default UV_TOOL_BIN_DIR on docker images (#13391)
Closes #13057 Sets `UV_TOOL_BIN_DIR` to `/usr/local/bin` for all derived images to allow `uv tool install` to work out of the box. Note, when the default image user is overwritten (e.g. `USER <UID>`) by a less privileged one, an alternative writable location would now need to be set by downstream consumers to prevent issues, hence I'm labeling this as a breaking change for 0.8.x release. Relates to astral-sh/uv-docker-example#55 Each image was tested to work with uv tool with `UV_TOOL_BIN_DIR` set to `/usr/local/bin` with the default root user and alternative non-root users to confirm breaking nature of the change.
1 parent d27cec7 commit 8644178

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

.github/workflows/build-docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ jobs:
225225
cat <<EOF > Dockerfile
226226
FROM ${BASE_IMAGE}
227227
COPY --from=${{ env.UV_GHCR_IMAGE }}:latest /uv /uvx /usr/local/bin/
228+
ENV UV_TOOL_BIN_DIR="/usr/local/bin"
228229
ENTRYPOINT []
229230
CMD ["/usr/local/bin/uv"]
230231
EOF

docs/guides/integration/docker.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ As with the distroless image, each derived image is published with uv version ta
7777
`ghcr.io/astral-sh/uv:{major}.{minor}.{patch}-{base}` and
7878
`ghcr.io/astral-sh/uv:{major}.{minor}-{base}`, e.g., `ghcr.io/astral-sh/uv:0.7.15-alpine`.
7979

80+
In addition, starting with `0.8` each derived image also sets `UV_TOOL_BIN_DIR` to `/usr/local/bin`
81+
to allow `uv tool install` to work as expected with the default user.
82+
8083
For more details, see the [GitHub Container](https://github.com/astral-sh/uv/pkgs/container/uv)
8184
page.
8285

0 commit comments

Comments
 (0)