From c80b8e3b47a9a09eea50e57382afe68a0635b1ba Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Wed, 12 Oct 2016 11:44:17 +0300 Subject: [PATCH] Add constraints to microservices venv Constraints file is taken from requirements repo URL, pip in venv is configured to always use it and never use cache dir (it's a very common option in our Dockerfiles). Note that the plan was to get URL from config but there's currently no good place in configs for it. Also removed --system-site-packages option to virtualenv as it defeats the purpose of constraints. Change-Id: I03a19b423b6617539d91fb29f44b40271849174f --- docker/openstack-base/Dockerfile.j2 | 10 +++++++--- docker/openstack-base/pip.conf | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 docker/openstack-base/pip.conf diff --git a/docker/openstack-base/Dockerfile.j2 b/docker/openstack-base/Dockerfile.j2 index 23cd2fb..cd23f27 100644 --- a/docker/openstack-base/Dockerfile.j2 +++ b/docker/openstack-base/Dockerfile.j2 @@ -13,10 +13,14 @@ RUN apt-get install -y --no-install-recommends \ git \ && apt-get clean -RUN git clone https://github.com/openstack/requirements.git \ +COPY pip.conf /tmp/pip.conf + +RUN curl -o /tmp/constraints.txt https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt \ && pip --no-cache-dir install -U virtualenv \ - && virtualenv --system-site-packages /var/lib/microservices/venv \ - && /var/lib/microservices/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt \ + && virtualenv /var/lib/microservices/venv \ + && mv /tmp/constraints.txt /var/lib/microservices/venv \ + && mv /tmp/pip.conf /var/lib/microservices/venv \ + && /var/lib/microservices/venv/bin/pip install --upgrade \ Babel \ Mako \ MarkupSafe \ diff --git a/docker/openstack-base/pip.conf b/docker/openstack-base/pip.conf new file mode 100644 index 0000000..93d9904 --- /dev/null +++ b/docker/openstack-base/pip.conf @@ -0,0 +1,3 @@ +[global] +constraint = /var/lib/microservices/venv/constraints.txt +no-cache-dir = false