|
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 | | - |
8 | 1 | FROM registry.ddbuild.io/images/mirror/ubuntu:25.04 |
9 | 2 |
|
| 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 | + |
10 | 6 | # Update sources and install required packages |
11 | 7 | RUN apt-get update \ |
12 | 8 | && apt-get -y install --no-install-recommends \ |
@@ -41,12 +37,14 @@ COPY --from=registry.ddbuild.io/dd-octo-sts:v1.10.4@sha256:20edc79b3fc3f9cd58eb0 |
41 | 37 | # Locales are required to be set to use click |
42 | 38 | ENV LC_ALL=C.UTF-8 |
43 | 39 | ENV LANG=C.UTF-8 |
| 40 | +ENV UV_TOOL_BIN_DIR=/usr/local/bin |
44 | 41 |
|
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