2014-11-20 18:48:51 +00:00
|
|
|
# vim:ft=dockerfile
|
2014-12-18 16:53:10 +00:00
|
|
|
|
2016-05-26 21:28:57 +00:00
|
|
|
FROM quay.io/jzelinskie/phusion-baseimage-xenial:e436d1c
|
2014-05-16 22:31:24 +00:00
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
ENV HOME /root
|
|
|
|
|
2016-05-26 21:28:57 +00:00
|
|
|
# Install system packages
|
|
|
|
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 \
|
2016-06-16 17:51:04 +00:00
|
|
|
nginx \
|
2016-05-26 21:28:57 +00:00
|
|
|
nodejs \
|
|
|
|
npm \
|
|
|
|
python-dev \
|
|
|
|
python-pip \
|
|
|
|
python-virtualenv
|
|
|
|
|
|
|
|
# Install python dependencies
|
2014-07-18 03:17:43 +00:00
|
|
|
ADD requirements.txt requirements.txt
|
|
|
|
RUN virtualenv --distribute venv
|
2016-05-26 21:28:57 +00:00
|
|
|
RUN venv/bin/pip install -r requirements.txt # 02JUN2016
|
2016-01-28 19:11:41 +00:00
|
|
|
RUN venv/bin/pip freeze
|
2014-05-22 16:13:41 +00:00
|
|
|
|
2016-05-26 21:28:57 +00:00
|
|
|
# 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
|
2016-06-02 16:37:02 +00:00
|
|
|
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) && \
|
2016-05-27 17:33:31 +00:00
|
|
|
rm pipinfo.txt
|
2016-05-26 21:28:57 +00:00
|
|
|
|
2016-04-25 21:13:38 +00:00
|
|
|
# Install cfssl
|
|
|
|
RUN mkdir /gocode
|
|
|
|
ENV GOPATH /gocode
|
|
|
|
RUN curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz && \
|
|
|
|
tar -xvf go1.6.linux-amd64.tar.gz && \
|
2016-05-26 21:28:57 +00:00
|
|
|
mv go /usr/local && \
|
2016-04-25 21:13:38 +00:00
|
|
|
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/cfssljson && \
|
2016-05-26 21:28:57 +00:00
|
|
|
cp /gocode/bin/cfssljson /bin/cfssljson && \
|
|
|
|
cp /gocode/bin/cfssl /bin/cfssl && \
|
|
|
|
rm -rf /gocode && rm -rf /usr/local/go
|
2016-04-25 21:13:38 +00:00
|
|
|
|
2016-04-28 21:20:32 +00:00
|
|
|
# Install jwtproxy
|
2016-04-29 01:10:28 +00:00
|
|
|
RUN curl -L -o /usr/local/bin/jwtproxy https://github.com/coreos/jwtproxy/releases/download/v0.0.1/jwtproxy-linux-x64
|
2016-04-28 21:37:28 +00:00
|
|
|
RUN chmod +x /usr/local/bin/jwtproxy
|
2016-04-28 21:20:32 +00:00
|
|
|
|
2014-11-05 17:45:14 +00:00
|
|
|
# Install Grunt
|
2014-07-18 03:17:43 +00:00
|
|
|
RUN ln -s /usr/bin/nodejs /usr/bin/node
|
|
|
|
RUN npm install -g grunt-cli
|
2014-05-16 22:31:24 +00:00
|
|
|
|
2014-11-05 17:45:14 +00:00
|
|
|
# Install Grunt depenencies
|
|
|
|
ADD grunt grunt
|
|
|
|
RUN cd grunt && npm install
|
|
|
|
|
2014-07-18 03:17:43 +00:00
|
|
|
# Run grunt
|
2016-04-25 16:13:58 +00:00
|
|
|
ADD static static
|
2014-05-22 16:13:41 +00:00
|
|
|
RUN cd grunt && grunt
|
|
|
|
|
2015-11-20 20:03:56 +00:00
|
|
|
RUN apt-get remove -y --auto-remove python-dev g++ libjpeg62-dev libevent-dev libldap2-dev libsasl2-dev libpq-dev libffi-dev libgpgme11-dev nodejs npm
|
|
|
|
RUN apt-get autoremove -y
|
|
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
RUN rm -rf grunt
|
|
|
|
|
2016-06-11 00:29:45 +00:00
|
|
|
# Set up the init system
|
2015-08-10 17:39:39 +00:00
|
|
|
ADD conf/init/copy_config_files.sh /etc/my_init.d/
|
2014-08-25 18:23:21 +00:00
|
|
|
ADD conf/init/doupdatelimits.sh /etc/my_init.d/
|
2015-03-26 13:21:45 +00:00
|
|
|
ADD conf/init/copy_syslog_config.sh /etc/my_init.d/
|
2016-04-25 21:13:38 +00:00
|
|
|
ADD conf/init/create_certs.sh /etc/my_init.d/
|
2014-05-22 16:13:41 +00:00
|
|
|
ADD conf/init/runmigration.sh /etc/my_init.d/
|
2015-09-01 15:42:26 +00:00
|
|
|
ADD conf/init/syslog-ng.conf /etc/syslog-ng/
|
2015-10-26 23:06:05 +00:00
|
|
|
ADD conf/init/zz_boot.sh /etc/my_init.d/
|
2015-03-26 13:21:45 +00:00
|
|
|
ADD conf/init/service/ /etc/service/
|
|
|
|
RUN rm -rf /etc/service/syslog-forwarder
|
2014-07-31 17:30:54 +00:00
|
|
|
|
2014-05-22 16:13:41 +00:00
|
|
|
# Download any external libs.
|
2014-07-18 03:17:43 +00:00
|
|
|
RUN mkdir static/fonts static/ldn
|
2016-04-26 13:30:31 +00:00
|
|
|
ADD external_libraries.py external_libraries.py
|
2014-05-22 16:13:41 +00:00
|
|
|
RUN venv/bin/python -m external_libraries
|
2016-06-16 17:51:04 +00:00
|
|
|
RUN mkdir -p /usr/local/nginx/logs/
|
2014-05-16 22:31:24 +00:00
|
|
|
|
2015-09-16 22:25:01 +00:00
|
|
|
# TODO(ssewell): only works on a detached head, make work with ref
|
2016-04-26 13:30:31 +00:00
|
|
|
ADD .git/HEAD GIT_HEAD
|
2015-09-16 15:44:58 +00:00
|
|
|
|
2016-04-25 16:13:58 +00:00
|
|
|
# Add all of the files!
|
|
|
|
ADD . .
|
2014-05-16 22:31:24 +00:00
|
|
|
|
2016-04-25 16:13:58 +00:00
|
|
|
# Run the tests
|
|
|
|
ARG RUN_TESTS=true
|
|
|
|
ENV RUN_TESTS ${RUN_TESTS}
|
|
|
|
|
|
|
|
RUN if [ "$RUN_TESTS" = true ]; then \
|
|
|
|
TEST=true venv/bin/python -m unittest discover -f; \
|
|
|
|
fi
|
|
|
|
RUN if [ "$RUN_TESTS" = true ]; then \
|
|
|
|
TEST=true venv/bin/python -m test.registry_tests -f; \
|
|
|
|
fi
|
2015-12-16 20:04:43 +00:00
|
|
|
RUN PYTHONPATH=. venv/bin/alembic heads | grep -E '^[0-9a-f]+ \(head\)$' > ALEMBIC_HEAD
|
2015-06-15 19:52:08 +00:00
|
|
|
|
2015-01-22 15:53:23 +00:00
|
|
|
VOLUME ["/conf/stack", "/var/log", "/datastorage", "/tmp", "/conf/etcd"]
|
2014-05-16 22:31:24 +00:00
|
|
|
|
2015-01-23 20:19:04 +00:00
|
|
|
EXPOSE 443 8443 80
|