Fix python license checking and uninstall docutils on build

This commit is contained in:
Sida Chen 2019-02-12 12:50:35 -05:00
parent 8d722dee81
commit 8434b65fcb

View file

@ -77,12 +77,22 @@ RUN curl -fsSL -o /usr/local/bin/prometheus-aggregator https://github.com/coreos
&& chmod +x /usr/local/bin/prometheus-aggregator
# Install python dependencies
# docutils is a setup dependency of botocore required by s3transfer. It's under
# GPLv3, and so should be removed.
COPY requirements.txt requirements-tests.txt ./
RUN virtualenv --distribute venv \
&& venv/bin/pip install -r requirements.txt \
&& venv/bin/pip install -r requirements-tests.txt \
&& (venv/bin/pip uninstall -y docutils || echo "docutils is not installed") \
&& venv/bin/pip freeze
# Check python dependencies for the GPL
# Due to the following bug, pip results must be piped to a file before grepping:
# https://github.com/pypa/pip/pull/3304
RUN venv/bin/pip freeze | grep -v "^-e" | awk -F'==' '{print $1}' | xargs venv/bin/pip --disable-pip-version-check show > pipinfo.txt && \
test -z "$(cat pipinfo.txt | grep GPL | grep -v LGPL)" && \
rm pipinfo.txt
# Install front-end dependencies
COPY static/ package.json tsconfig.json webpack.config.js tslint.json yarn.lock ./
RUN yarn install --ignore-engines
@ -99,12 +109,7 @@ RUN adduser memcached --disabled-login --system
WORKDIR $QUAYDIR
# Check python dependencies for the GPL
# Due to the following bug, pip results must be piped to a file before grepping:
# https://github.com/pypa/pip/pull/3304
RUN cat requirements.txt | grep -v "^-e" | awk -F'==' '{print $1}' | xargs venv/bin/pip --disable-pip-version-check show > pipinfo.txt && \
test -z "$(cat pipinfo.txt | grep GPL | grep -v LGPL)" && \
rm pipinfo.txt
# JS compile
COPY bill-of-materials.json bill-of-materials.json