This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/Dockerfile

184 lines
5.4 KiB
Text
Raw Normal View History

# vim:ft=dockerfile
FROM phusion/baseimage:0.9.19
ENV DEBIAN_FRONTEND noninteractive
ENV HOME /root
# 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
# Install system packages
RUN apt-get update # 31JAN2017
RUN apt-get install -y \
g++ \
gdb \
gdebi-core \
git \
2016-12-02 18:20:01 +00:00
jpegoptim \
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 \
monit \
nginx \
nodejs \
npm \
2016-12-02 18:20:01 +00:00
optipng \
python-dbg \
python-dev \
python-pip \
python-virtualenv
# Install python dependencies
ADD requirements.txt requirements.txt
RUN virtualenv --distribute venv
RUN venv/bin/pip install -r requirements.txt # 07SEP2016
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
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) && \
rm pipinfo.txt
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 && \
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 && \
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
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
# 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
# Install Webpack, Typescript, React
RUN ln -s /usr/bin/nodejs /usr/bin/node
ADD package.json package.json
2016-10-26 17:59:41 +00:00
ADD tsconfig.json tsconfig.json
ADD webpack.config.js webpack.config.js
ADD typings.json typings.json
RUN npm install
RUN npm link typescript
# Add static files
2016-10-26 17:59:41 +00:00
ADD static static
2016-10-25 19:36:21 +00:00
ADD static/js/directives/components static/dist/components
# Run Webpack
RUN npm install -g webpack
RUN webpack
2017-01-10 02:05:49 +00:00
# Run front-end tests
ARG RUN_TESTS=true
ENV RUN_TESTS ${RUN_TESTS}
2017-01-10 02:05:49 +00:00
ADD karma.conf.js karma.conf.js
RUN if [ "$RUN_TESTS" = true ]; then \
npm test; \
fi
2017-01-10 02:05:49 +00:00
# Install Grunt
RUN npm install -g grunt-cli
# Install Grunt depenencies
ADD grunt grunt
RUN cd grunt && npm install
# Run grunt
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
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 jpegoptim optipng
RUN apt-get autoremove -y
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN rm -rf .npm
RUN rm -rf grunt
2016-10-20 18:49:44 +00:00
RUN rm -rf node_modules
# Set up the init system
ADD conf/init/copy_config_files.sh /etc/my_init.d/
ADD conf/init/doupdatelimits.sh /etc/my_init.d/
ADD conf/init/copy_syslog_config.sh /etc/my_init.d/
ADD conf/init/certs_create.sh /etc/my_init.d/
ADD conf/init/certs_install.sh /etc/my_init.d/
ADD conf/init/runmigration.sh /etc/my_init.d/
ADD conf/init/syslog-ng.conf /etc/syslog-ng/
ADD conf/init/zz_boot.sh /etc/my_init.d/
ADD conf/init/service/ /etc/service/
RUN rm -rf /etc/service/syslog-forwarder
ADD conf/kill-buildmanager.sh /usr/local/bin/kill-buildmanager.sh
ADD conf/monitrc /etc/monit/monitrc
RUN chmod 0600 /etc/monit/monitrc
# remove after phusion/baseimage-docker#338 is fixed
ADD conf/init/logrotate.conf /etc/logrotate.conf
# Download any external libs.
RUN mkdir static/fonts static/ldn
2016-04-26 13:30:31 +00:00
ADD external_libraries.py external_libraries.py
RUN venv/bin/python -m external_libraries
RUN mkdir -p /usr/local/nginx/logs/
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
# Add all of the files!
ADD . .
2017-02-01 19:16:21 +00:00
RUN pyclean .
# Run the tests
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
RUN if [ "$RUN_TESTS" = true ]; then \
TEST=true PYTHONPATH="." venv/bin/py.test --timeout=7200 --verbose \
--show-count -x --color=no ./; \
fi
2016-11-24 14:18:22 +00:00
RUN if [ "$RUN_TESTS" = true ]; then \
TEST=true PYTHONPATH="." venv/bin/py.test --timeout=7200 --verbose \
--show-count -x --color=no test/registry_tests.py ; \
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
VOLUME ["/conf/stack", "/var/log", "/datastorage", "/tmp", "/conf/etcd"]
2015-01-23 20:19:04 +00:00
EXPOSE 443 8443 80