Derive the version from git with verri
Use verri's strawberry flavour through hatchling's code version source, so versions look like 2026.10.21.0: the HEAD commit date plus the number of earlier commits that day. Container images build the sdist in a separate stage that has the git repository, so they get the same version instead of a +vcs.missing one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e7ef15fc79
commit
ee980b27fe
5 files changed
+32
-10
No files matched your search
+17
-4
@@ -35,6 +35,21 @@ RUN yarn install --frozen-lockfile --network-timeout 600000
|
||||
RUN yarn build && test -f dist/index.html
|
||||
|
||||
|
||||
# Builds peo's sdist from the git repository, because verri derives the version
|
||||
# from the git history (see version.py). The unpacked sdist carries that version
|
||||
# in PKG-INFO, so the images below can be built without git.
|
||||
FROM ${SLIM_BASE_IMAGE} AS sdist
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends git python3-build python3-venv \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY . /src
|
||||
RUN python3 -m build --sdist --outdir /dist /src \
|
||||
&& mkdir /peo \
|
||||
&& tar -xzf /dist/peo-*.tar.gz --strip-components=1 -C /peo
|
||||
|
||||
|
||||
FROM ${SLIM_BASE_IMAGE} AS slim
|
||||
|
||||
RUN apt-get update \
|
||||
@@ -45,8 +60,7 @@ RUN apt-get update \
|
||||
# notices: see THIRD_PARTY_NOTICES.md.
|
||||
COPY container/collect-python-licenses.py /tmp/
|
||||
COPY container/licenses/ /tmp/licenses/
|
||||
COPY pyproject.toml README.md LICENSE /tmp/peo/
|
||||
COPY peo /tmp/peo/peo
|
||||
COPY --from=sdist /peo /tmp/peo
|
||||
RUN python3 -m venv --system-site-packages /opt/peo/venv \
|
||||
&& /opt/peo/venv/bin/pip install --no-cache-dir "/tmp/peo[browser]" \
|
||||
&& /opt/peo/venv/bin/python /tmp/collect-python-licenses.py \
|
||||
@@ -94,8 +108,7 @@ RUN /opt/pgadmin/bin/python /tmp/collect-python-licenses.py \
|
||||
/usr/share/doc/peo/pgadmin-python-licenses /tmp/licenses
|
||||
|
||||
# peo itself, using Debian's psycopg and the other dependencies from PyPI.
|
||||
COPY pyproject.toml README.md LICENSE /tmp/peo/
|
||||
COPY peo /tmp/peo/peo
|
||||
COPY --from=sdist /peo /tmp/peo
|
||||
RUN python3 -m venv --system-site-packages /opt/peo/venv \
|
||||
&& /opt/peo/venv/bin/pip install --no-cache-dir "/tmp/peo[browser]" \
|
||||
&& /opt/peo/venv/bin/python /tmp/collect-python-licenses.py \
|
||||
|
||||
Reference in new issue
Block a user