Use virtualenv for building

So the virtualenv-does-not-belong-in-container argument is null and
void! (SamYaple eyes ayoung...)

Due to the deps we have we end up installing python-requests from the
package manager. This leads to `pip wheel` failing to build because the
installed version of requests is too old. A venv solves this problem
(and removes the need for hash -r).

A venv should *not* be needed for project containers since the deps are
isolated. But should deps interfere we may be forced into venvs in the
project containers later. For now, it is isolated to builds.

Change-Id: Id38a115ba925fd6930789ed65db64f6e3709af3e
Depends-On: I453f8ecbb41cda3bb68ebc7ae5f5198ca9c9d772
This commit is contained in:
Sam Yaple 2017-04-14 02:38:27 +00:00
parent ed7d47fca6
commit fc41e95ea8
3 changed files with 18 additions and 8 deletions

View File

@ -1,6 +1,7 @@
FROM centos:7
ENV PROJECT=requirements
ENV PROJECT=requirements \
PATH=/builder/bin:$PATH
ARG PROJECT_REPO=https://git.openstack.org/openstack/${PROJECT}
ARG PROJECT_REF=master
ARG OVERRIDE=override
@ -35,6 +36,7 @@ RUN set -x \
python \
python-devel \
python-pip \
python-virtualenv \
libgcrypt \
nss-util \
systemd-devel \
@ -43,7 +45,9 @@ RUN set -x \
&& git --git-dir /tmp/requirements/.git fetch --depth 1 $PROJECT_REPO $PROJECT_REF \
&& git --work-tree /tmp/requirements --git-dir /tmp/requirements/.git checkout FETCH_HEAD \
&& mv /tmp/requirements/global-requirements.txt /tmp/requirements/upper-constraints.txt /root/packages/ \
&& pip install -U pip wheel setuptools \
&& python -m virtualenv /builder \
&& pip install -U pip \
&& pip install -U wheel setuptools \
# NOTE(SamYaple): There is a bug with python-nss, this is a workaround. https://bugzilla.redhat.com/show_bug.cgi?id=1389739
&& sed -i '/dogtag-pki/d' /root/packages/global-requirements.txt \
&& pip download -d /tmp -c /root/packages/upper-constraints.txt python-nss \

10
debian/Dockerfile vendored
View File

@ -1,6 +1,7 @@
FROM debian:jessie-slim
ENV PROJECT=requirements
ENV PROJECT=requirements \
PATH=/builder/bin:$PATH
ARG PROJECT_REPO=https://git.openstack.org/openstack/${PROJECT}
ARG PROJECT_REF=master
ARG OVERRIDE=override
@ -31,14 +32,15 @@ RUN set -x \
pkg-config \
python-dev \
python-pip \
python-virtualenv \
&& mkdir /root/packages \
&& git init /tmp/requirements \
&& git --git-dir /tmp/requirements/.git fetch --depth 1 $PROJECT_REPO $PROJECT_REF \
&& git --work-tree /tmp/requirements --git-dir /tmp/requirements/.git checkout FETCH_HEAD \
&& mv /tmp/requirements/global-requirements.txt /tmp/requirements/upper-constraints.txt /root/packages/ \
&& pip install -U pip wheel setuptools \
# TODO(pbourke): 'hash -r' should no longer be required once we move to stretch
&& hash -r \
&& python -m virtualenv /builder \
&& pip install -U pip \
&& pip install -U wheel setuptools \
# NOTE(SamYaple): There is a bug with python-nss, this is a workaround. https://bugzilla.redhat.com/show_bug.cgi?id=1389739
&& sed -i '/dogtag-pki/d' /root/packages/global-requirements.txt \
&& pip download -d /tmp -c /root/packages/upper-constraints.txt python-nss \

View File

@ -1,6 +1,7 @@
FROM ubuntu:xenial
ENV PROJECT=requirements
ENV PROJECT=requirements \
PATH=/builder/bin:$PATH
ARG PROJECT_REPO=https://git.openstack.org/openstack/${PROJECT}
ARG PROJECT_REF=master
ARG OVERRIDE=override
@ -31,12 +32,15 @@ RUN set -x \
python \
python-dev \
python-pip \
python-virtualenv \
&& mkdir /root/packages \
&& git init /tmp/requirements \
&& git --git-dir /tmp/requirements/.git fetch --depth 1 $PROJECT_REPO $PROJECT_REF \
&& git --work-tree /tmp/requirements --git-dir /tmp/requirements/.git checkout FETCH_HEAD \
&& mv /tmp/requirements/global-requirements.txt /tmp/requirements/upper-constraints.txt /root/packages/ \
&& pip install -U pip wheel setuptools \
&& python -m virtualenv /builder \
&& pip install -U pip \
&& pip install -U wheel setuptools \
# NOTE(SamYaple): There is a bug with python-nss, this is a workaround. https://bugzilla.redhat.com/show_bug.cgi?id=1389739
&& sed -i '/dogtag-pki/d' /root/packages/global-requirements.txt \
&& pip download -d /tmp -c /root/packages/upper-constraints.txt python-nss \