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
This commit is contained in:
Yuriy Taraday 2016-10-12 11:44:17 +03:00
parent e3fee64d44
commit c80b8e3b47
2 changed files with 10 additions and 3 deletions

View File

@ -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 \

View File

@ -0,0 +1,3 @@
[global]
constraint = /var/lib/microservices/venv/constraints.txt
no-cache-dir = false