Skip to content

Commit e1913b0

Browse files
authored
Use uv to install tools in tagger image (DataDog#23221)
* Use pipx to install ddev and awscli in tagger image * Use pipx venv copy instead of building sdist tarball * Use ARG for base image so bumping requires a single line change * Switch to uv for zero-maintenance Python version management * Revert HATCH_VCS_PRETEND_VERSION attempt, writable copy is required
1 parent 0e56ec4 commit e1913b0

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

.gitlab/tagger/Dockerfile

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
# Use a separate image to build ddev from source so the final image doesn't need git
2-
FROM registry.ddbuild.io/images/mirror/python:3.13.0 AS ddev-python
3-
COPY . /home
4-
RUN python -m pip install build
5-
RUN python -m build -s ./home/ddev
6-
RUN mv ./home/ddev/dist/*.tar.gz ddev.tar.gz
7-
81
FROM registry.ddbuild.io/images/mirror/ubuntu:25.04
92

3+
# Get uv — manages Python installations on demand, no system Python pinning needed
4+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
5+
106
# Update sources and install required packages
117
RUN apt-get update \
128
&& apt-get -y install --no-install-recommends \
@@ -41,12 +37,14 @@ COPY --from=registry.ddbuild.io/dd-octo-sts:v1.10.4@sha256:20edc79b3fc3f9cd58eb0
4137
# Locales are required to be set to use click
4238
ENV LC_ALL=C.UTF-8
4339
ENV LANG=C.UTF-8
40+
ENV UV_TOOL_BIN_DIR=/usr/local/bin
4441

45-
# Copy in ddev.tar.gz from the other image
46-
COPY --from=ddev-python ddev.tar.gz /
47-
48-
# Install pip and ddev for release tagging
49-
# Install awscli for access to the key used for signing in integrations-extras and marketplace
50-
RUN curl -sSL https://bootstrap.pypa.io/get-pip.py | python3 - --break-system-packages \
51-
&& pip3 install --no-cache-dir --break-system-packages awscli==1.29.7 \
52-
&& pip3 install --no-cache-dir --break-system-packages ddev.tar.gz
42+
# Mount the build context without adding it to the image.
43+
# Copy to a writable location because hatch-vcs writes src/ddev/_version.py during build,
44+
# which fails on the read-only bind mount. Both the copy and removal are in one RUN
45+
# so the source never lands in the final image.
46+
RUN --mount=type=bind,source=.,target=/src \
47+
cp -r /src /tmp/repo \
48+
&& uv tool install /tmp/repo/ddev \
49+
&& uv tool install 'awscli==1.29.7' \
50+
&& rm -rf /tmp/repo

0 commit comments

Comments
 (0)