Include uvx binary to docker image. (#4764)

Fix #4763

## Summary

Modify the Dockerfile to include the uvx binary in the docker image
`ghcr.io/astral-sh/uv`.

## Test Plan

I have verified that the uvx binary is included in the Docker image
built with the following command and can be executed.

```bash
# cd repository root
docker build -t uv:add_uvx .
docker run --rm --entrypoint /uvx uv -V

uv-tool-run 0.2.21
```
This commit is contained in:
Di-Is 2024-07-03 20:51:55 +09:00 committed by GitHub
parent 42415997b1
commit 60fd98a5e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,12 +34,14 @@ RUN rustup target add $(cat rust_target.txt)
COPY crates crates COPY crates crates
COPY ./Cargo.toml Cargo.toml COPY ./Cargo.toml Cargo.toml
COPY ./Cargo.lock Cargo.lock COPY ./Cargo.lock Cargo.lock
RUN cargo zigbuild --bin uv --target $(cat rust_target.txt) --release RUN cargo zigbuild --bin uv --bin uvx --target $(cat rust_target.txt) --release
RUN cp target/$(cat rust_target.txt)/release/uv /uv RUN cp target/$(cat rust_target.txt)/release/uv /uv \
&& cp target/$(cat rust_target.txt)/release/uvx /uvx
# TODO(konsti): Optimize binary size, with a version that also works when cross compiling # TODO(konsti): Optimize binary size, with a version that also works when cross compiling
# RUN strip --strip-all /uv # RUN strip --strip-all /uv
FROM scratch FROM scratch
COPY --from=build /uv /uv COPY --from=build /uv /uv
COPY --from=build /uvx /uvx
WORKDIR /io WORKDIR /io
ENTRYPOINT ["/uv"] ENTRYPOINT ["/uv"]