astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
24.1k stars 695 forks source link

Publish Docker image: ghcr.io/astral-sh/uv #2774

Closed bschoenmaeckers closed 6 months ago

bschoenmaeckers commented 6 months ago

There is a Dockerfile available in the repo but it is not (yet) published to the package registry.

zanieb commented 6 months ago

We had this during development but turned it off on launch — to be revisited.

Can you share more about your use-case for the image?

bschoenmaeckers commented 6 months ago

I would like to use it in a slim docker image like shown below, this way docker will cache the latest uv binary but does not include it into the final image.

FROM ghcr.io/astral-sh/uv as uv
FROM python:alpine
RUN --mount=type=cache,target=/root/.cache/uv \
        --mount=from=uv,source=/uv,target=./uv \
        ./uv pip install .....
helderco commented 6 months ago

Yeah, much easier and efficient installation method when working with containers!

I'm currently doing a pip install and pulling that binary in multi-stage, just to avoid installing curl for the install script. That mostly just tries to figure the current OS and arch, but with a multi-platformat container images that's handled automatically already. Also, pulling from uv and python base image can be done in parallel here, while doing the install in a RUN doesn't.

zanieb commented 6 months ago

cc @charliermarsh who has more context on how hard it would be to enable this again

bschoenmaeckers commented 6 months ago

It would also be nice to have an image with the latest python for building wheels in the CI.

uv pip install build[uv] twine
python -m build --installer uv
python -m twine upload dist/*
helderco commented 6 months ago

You can use multi stage to copy uv into any image. That'll keep the uv image as small as possible for faster download.

helderco commented 6 months ago

It's great that this is in 🙌

Can you tag the image with the release version though? That would help with pinning.

zanieb commented 6 months ago

We will, there was just a permissions issue in the last release #3195