dockerfile: 16.04 baseimage, add GPL check

This commit is contained in:
Jimmy Zelinskie 2016-05-26 17:28:57 -04:00
parent 70f794b0af
commit 56b2655326

View file

@ -1,22 +1,51 @@
# vim:ft=dockerfile # vim:ft=dockerfile
FROM phusion/baseimage:0.9.18 FROM quay.io/jzelinskie/phusion-baseimage-xenial:e436d1c
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
ENV HOME /root ENV HOME /root
# Install the dependencies. # Install system packages
RUN apt-get update # 07APR2016 RUN apt-get update # 02JUN2016
RUN apt-get install -y \
g++ \
gdebi-core \
git \
libevent-2.0.5 \
libevent-dev \
libffi-dev \
libfreetype6-dev \
libgpgme11 \
libgpgme11-dev \
libjpeg62 \
libjpeg62-dev \
libjpeg8 \
libldap-2.4-2 \
libldap2-dev \
libmagic1 \
libpq-dev \
libpq5 \
libsasl2-dev \
libsasl2-modules \
nodejs \
npm \
phantomjs \
python-dev \
python-pip \
python-virtualenv
# New ubuntu packages should be added as their own apt-get install lines below the existing install commands # Install python dependencies
RUN apt-get install -y git python-virtualenv python-dev libjpeg8 libjpeg62 libjpeg62-dev libevent-2.0.5 libevent-dev gdebi-core g++ libmagic1 phantomjs nodejs npm libldap-2.4-2 libldap2-dev libsasl2-modules libsasl2-dev libpq5 libpq-dev libfreetype6-dev libffi-dev libgpgme11 libgpgme11-dev
# Build the python dependencies
ADD requirements.txt requirements.txt ADD requirements.txt requirements.txt
RUN virtualenv --distribute venv RUN virtualenv --distribute venv
RUN venv/bin/pip install -r requirements.txt # 01MAR2016 RUN venv/bin/pip install -r requirements.txt # 02JUN2016
RUN venv/bin/pip freeze RUN 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 cat requirements.txt | grep -v "^-e" | awk -F'==' '{print $1}' | xargs venv/bin/pip --disable-pip-version-check show > pipinfo.txt
RUN test -z $(cat pipinfo.txt | grep GPL | grep -v LGPL)
# Install the binary dependencies # Install the binary dependencies
ADD binary_dependencies binary_dependencies ADD binary_dependencies binary_dependencies
RUN gdebi --n binary_dependencies/*.deb RUN gdebi --n binary_dependencies/*.deb
@ -26,13 +55,13 @@ RUN mkdir /gocode
ENV GOPATH /gocode ENV GOPATH /gocode
RUN curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz && \ RUN curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz && \
tar -xvf go1.6.linux-amd64.tar.gz && \ tar -xvf go1.6.linux-amd64.tar.gz && \
sudo mv go /usr/local && \ mv go /usr/local && \
rm -rf go1.6.linux-amd64.tar.gz && \ rm -rf go1.6.linux-amd64.tar.gz && \
/usr/local/go/bin/go get -u github.com/cloudflare/cfssl/cmd/cfssl && \ /usr/local/go/bin/go get -u github.com/cloudflare/cfssl/cmd/cfssl && \
/usr/local/go/bin/go get -u github.com/cloudflare/cfssl/cmd/cfssljson && \ /usr/local/go/bin/go get -u github.com/cloudflare/cfssl/cmd/cfssljson && \
sudo cp /gocode/bin/cfssljson /bin/cfssljson && \ cp /gocode/bin/cfssljson /bin/cfssljson && \
sudo cp /gocode/bin/cfssl /bin/cfssl && \ cp /gocode/bin/cfssl /bin/cfssl && \
sudo rm -rf /gocode && sudo rm -rf /usr/local/go rm -rf /gocode && rm -rf /usr/local/go
# Install jwtproxy # Install jwtproxy
RUN curl -L -o /usr/local/bin/jwtproxy https://github.com/coreos/jwtproxy/releases/download/v0.0.1/jwtproxy-linux-x64 RUN curl -L -o /usr/local/bin/jwtproxy https://github.com/coreos/jwtproxy/releases/download/v0.0.1/jwtproxy-linux-x64
@ -79,10 +108,6 @@ ADD .git/HEAD GIT_HEAD
# Add all of the files! # Add all of the files!
ADD . . ADD . .
# If a pip package is licensed as GPL, fail the build.
# If this fails the build, change the last grep to be "grep -B 10 GPL" to see what package is GPLed.
RUN test -z "$(cat requirements.txt | grep -v "^-e" | awk -F'==' '{print $1}' | xargs pip show --disable-pip-version-check | grep -v LGPL | grep GPL)"
# Run the tests # Run the tests
ARG RUN_TESTS=true ARG RUN_TESTS=true
ENV RUN_TESTS ${RUN_TESTS} ENV RUN_TESTS ${RUN_TESTS}