From d2603402ea0a02aefd00ee709c5343b4ab0a4beb Mon Sep 17 00:00:00 2001 From: Matt Baker <93600443+matthbakeredb@users.noreply.github.com> Date: Mon, 4 Sep 2023 20:24:26 +0100 Subject: [PATCH] Debian docker image pip error (#2849) * Use virtualenv to install tox in behave Dockerfile Upstream change in postgres docker image uses debian restriction on installing system-wide non-debian python packages. Debian doesn't provide a tox>=4, so we need to install with pip. * Exclude all output directories generated using `tox-wrapper.sh` The `tox-wrapper.sh` script created by `features/Dockerfile` creates directories like features/output-tox-pg14-docker-behave-etcd-lin-973719674/ * Reduce footprint of tox behave docker image --- .gitignore | 2 +- features/Dockerfile | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 23cbf17a..c902c6eb 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,7 @@ nosetests.xml coverage.xml htmlcov junit.xml -features/output +features/output* dummy # Translations diff --git a/features/Dockerfile b/features/Dockerfile index 86c6041d..7f52c2af 100644 --- a/features/Dockerfile +++ b/features/Dockerfile @@ -27,8 +27,8 @@ RUN set -ex \ && apt-get update \ && apt-get reinstall init-system-helpers \ && apt-get install -y \ - python3-pip \ python3-dev \ + python3-venv \ rsync \ curl \ gcc \ @@ -40,7 +40,9 @@ RUN set -ex \ net-tools \ iputils-ping \ && rm -rf /var/cache/apt \ - && python3 -m pip install --no-cache-dir tox \ + \ + && python3 -m venv /tox \ + && /tox/bin/pip install --no-cache-dir tox>=4 \ \ && mkdir -p "$PGHOME" \ && sed -i "s|/var/lib/postgresql.*|$PGHOME:/bin/bash|" /etc/passwd \ @@ -50,6 +52,7 @@ RUN set -ex \ && curl -sL "$ETCDURL/etcd-v$ETCDVERSION-linux-$(dpkg --print-architecture).tar.gz" \ | tar xz -C /usr/local/bin --strip=1 --wildcards --no-anchored etcd etcdctl +ENV PATH="/tox/bin:$PATH" # This Dockerfile syntax only works with docker buildx and the syntax # line at the top of this file.