2014-11-20 18:48:51 +00:00
|
|
|
# vim:ft=dockerfile
|
2014-12-18 16:53:10 +00:00
|
|
|
|
2016-09-07 19:55:58 +00:00
|
|
|
FROM phusion/baseimage:0.9.19
|
2014-05-16 22:31:24 +00:00
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
ENV HOME /root
|
|
|
|
|
2016-11-17 21:25:16 +00:00
|
|
|
# This is so we don't break http golang/go#17066
|
|
|
|
# When Ubuntu has nginx >= 1.11.0 we can switch back.
|
|
|
|
RUN add-apt-repository ppa:nginx/development
|
|
|
|
|
2017-02-28 01:02:30 +00:00
|
|
|
# Add Yarn repository until it is officially added to Ubuntu
|
2017-02-27 22:36:17 +00:00
|
|
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
|
|
|
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
|
|
|
|
2016-05-26 21:28:57 +00:00
|
|
|
# Install system packages
|
2017-04-27 18:06:44 +00:00
|
|
|
RUN apt-get update && apt-get upgrade -y # 27APR2017
|
2016-05-26 21:28:57 +00:00
|
|
|
RUN apt-get install -y \
|
2017-02-23 20:34:58 +00:00
|
|
|
dnsmasq \
|
2016-05-26 21:28:57 +00:00
|
|
|
g++ \
|
2016-11-17 00:41:14 +00:00
|
|
|
gdb \
|
2016-05-26 21:28:57 +00:00
|
|
|
gdebi-core \
|
|
|
|
git \
|
2016-12-02 18:20:01 +00:00
|
|
|
jpegoptim \
|
2016-05-26 21:28:57 +00:00
|
|
|
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-11-02 18:06:07 +00:00
|
|
|
monit \
|
2016-06-16 17:51:04 +00:00
|
|
|
nginx \
|
2016-05-26 21:28:57 +00:00
|
|
|
nodejs \
|
2016-12-02 18:20:01 +00:00
|
|
|
optipng \
|
2017-05-01 19:51:54 +00:00
|
|
|
openssl \
|
2016-11-17 00:41:14 +00:00
|
|
|
python-dbg \
|
2016-05-26 21:28:57 +00:00
|
|
|
python-dev \
|
|
|
|
python-pip \
|
2017-02-28 06:02:40 +00:00
|
|
|
python-virtualenv \
|
2017-04-27 18:06:44 +00:00
|
|
|
yarn=0.22.0-1 \
|
2017-03-24 02:50:38 +00:00
|
|
|
w3m
|
2016-05-26 21:28:57 +00:00
|
|
|
|
|
|
|
# Install python dependencies
|
2014-07-18 03:17:43 +00:00
|
|
|
ADD requirements.txt requirements.txt
|
|
|
|
RUN virtualenv --distribute venv
|
2016-09-07 19:55:58 +00:00
|
|
|
RUN venv/bin/pip install -r requirements.txt # 07SEP2016
|
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
|
|
|
|
2016-07-01 18:16:15 +00:00
|
|
|
# Install prometheus-aggregator
|
|
|
|
RUN curl -L -o /usr/local/bin/prometheus-aggregator https://github.com/coreos/prometheus-aggregator/releases/download/v0.0.1-alpha/prometheus-aggregator
|
|
|
|
RUN chmod +x /usr/local/bin/prometheus-aggregator
|
|
|
|
|
2017-02-28 01:02:30 +00:00
|
|
|
# Install front-end dependencies
|
2014-07-18 03:17:43 +00:00
|
|
|
RUN ln -s /usr/bin/nodejs /usr/bin/node
|
2016-09-27 18:06:28 +00:00
|
|
|
ADD package.json package.json
|
2016-10-26 17:59:41 +00:00
|
|
|
ADD tsconfig.json tsconfig.json
|
2016-09-27 18:06:28 +00:00
|
|
|
ADD webpack.config.js webpack.config.js
|
|
|
|
ADD typings.json typings.json
|
2017-03-16 21:52:16 +00:00
|
|
|
ADD yarn.lock yarn.lock
|
2017-02-27 22:36:17 +00:00
|
|
|
RUN yarn install --ignore-engines
|
2016-09-27 18:06:28 +00:00
|
|
|
|
|
|
|
# Add static files
|
2016-10-26 17:59:41 +00:00
|
|
|
ADD static static
|
2016-09-27 18:06:28 +00:00
|
|
|
|
|
|
|
# Run Webpack
|
2017-02-06 22:05:19 +00:00
|
|
|
RUN node_modules/.bin/webpack --progress
|
2016-09-27 18:06:28 +00:00
|
|
|
|
2017-01-10 02:05:49 +00:00
|
|
|
# Run front-end tests
|
2017-01-13 21:20:31 +00:00
|
|
|
ARG RUN_TESTS=true
|
|
|
|
ENV RUN_TESTS ${RUN_TESTS}
|
|
|
|
|
2017-01-10 02:05:49 +00:00
|
|
|
ADD karma.conf.js karma.conf.js
|
2017-01-13 21:20:31 +00:00
|
|
|
RUN if [ "$RUN_TESTS" = true ]; then \
|
2017-02-28 01:02:30 +00:00
|
|
|
yarn test; \
|
2017-01-13 21:20:31 +00:00
|
|
|
fi
|
2017-01-10 02:05:49 +00:00
|
|
|
|
2017-02-28 01:02:30 +00:00
|
|
|
# Install Grunt and Grunt depenencies
|
|
|
|
RUN yarn global add grunt-cli
|
2014-11-05 17:45:14 +00:00
|
|
|
ADD grunt grunt
|
2017-02-28 01:02:30 +00:00
|
|
|
RUN cd grunt && yarn install
|
2014-11-05 17:45:14 +00:00
|
|
|
|
2017-02-28 01:02:30 +00:00
|
|
|
# Run Grunt
|
2014-05-22 16:13:41 +00:00
|
|
|
RUN cd grunt && grunt
|
|
|
|
|
2016-12-02 18:20:01 +00:00
|
|
|
# Optimize our images
|
|
|
|
ADD static/img static/img
|
|
|
|
RUN jpegoptim static/img/**/*.jpg
|
|
|
|
RUN optipng -clobber -quiet static/img/**/*.png
|
|
|
|
|
2017-03-10 19:01:37 +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 jpegoptim optipng w3m
|
2015-11-20 20:03:56 +00:00
|
|
|
RUN apt-get autoremove -y
|
|
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
|
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-09-19 21:55:08 +00:00
|
|
|
ADD conf/init/certs_create.sh /etc/my_init.d/
|
|
|
|
ADD conf/init/certs_install.sh /etc/my_init.d/
|
2017-02-13 19:14:44 +00:00
|
|
|
ADD conf/init/nginx_conf_create.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
|
|
|
|
2016-11-17 00:41:14 +00:00
|
|
|
ADD conf/kill-buildmanager.sh /usr/local/bin/kill-buildmanager.sh
|
2016-11-02 18:06:07 +00:00
|
|
|
ADD conf/monitrc /etc/monit/monitrc
|
|
|
|
RUN chmod 0600 /etc/monit/monitrc
|
|
|
|
|
2016-09-08 17:52:39 +00:00
|
|
|
# remove after phusion/baseimage-docker#338 is fixed
|
|
|
|
ADD conf/init/logrotate.conf /etc/logrotate.conf
|
|
|
|
|
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 . .
|
2017-02-01 19:16:21 +00:00
|
|
|
RUN pyclean .
|
2014-05-16 22:31:24 +00:00
|
|
|
|
2017-02-23 20:34:58 +00:00
|
|
|
# Cleanup any NPM-related stuff.
|
|
|
|
RUN rm -rf /root/.npm
|
|
|
|
RUN rm -rf /.npm
|
|
|
|
RUN rm -rf /usr/local/lib/node_modules
|
|
|
|
RUN rm -rf /root/node_modules
|
|
|
|
RUN rm -rf /node_modules
|
|
|
|
RUN rm -rf /grunt
|
2017-03-16 22:45:57 +00:00
|
|
|
RUN rm package.json yarn.lock
|
2017-02-23 20:34:58 +00:00
|
|
|
|
2016-04-25 16:13:58 +00:00
|
|
|
# Run the tests
|
2016-07-13 18:23:30 +00:00
|
|
|
ENV RUN_ACI_TESTS False
|
2016-11-24 14:18:22 +00:00
|
|
|
ADD requirements-tests.txt requirements-tests.txt
|
|
|
|
|
|
|
|
RUN if [ "$RUN_TESTS" = true ]; then \
|
|
|
|
venv/bin/pip install -r requirements-tests.txt ;\
|
|
|
|
fi
|
2016-04-25 16:13:58 +00:00
|
|
|
|
2016-12-29 23:36:59 +00:00
|
|
|
|
2016-04-25 16:13:58 +00:00
|
|
|
RUN if [ "$RUN_TESTS" = true ]; then \
|
2016-12-29 23:36:59 +00:00
|
|
|
TEST=true PYTHONPATH="." venv/bin/py.test --timeout=7200 --verbose \
|
2016-12-28 21:43:08 +00:00
|
|
|
--show-count -x --color=no ./; \
|
2016-04-25 16:13:58 +00:00
|
|
|
fi
|
2016-11-24 14:18:22 +00:00
|
|
|
|
2016-04-25 16:13:58 +00:00
|
|
|
RUN if [ "$RUN_TESTS" = true ]; then \
|
2016-12-29 23:36:59 +00:00
|
|
|
TEST=true PYTHONPATH="." venv/bin/py.test --timeout=7200 --verbose \
|
2016-12-28 19:22:49 +00:00
|
|
|
--show-count -x --color=no test/registry_tests.py ; \
|
2016-04-25 16:13:58 +00:00
|
|
|
fi
|
2016-11-24 14:18:22 +00:00
|
|
|
|
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
|