# vim:ft=dockerfile FROM phusion/baseimage:0.9.18 ENV DEBIAN_FRONTEND noninteractive ENV HOME /root # Install the dependencies. RUN apt-get update # 07APR2016 # New ubuntu packages should be added as their own apt-get install lines below the existing install commands 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 RUN virtualenv --distribute venv RUN venv/bin/pip install -r requirements.txt # 01MAR2016 RUN venv/bin/pip freeze # Install the binary dependencies ADD binary_dependencies binary_dependencies RUN gdebi --n binary_dependencies/*.deb # 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 && \ sudo mv go /usr/local && \ 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 && \ sudo cp /gocode/bin/cfssljson /bin/cfssljson && \ sudo cp /gocode/bin/cfssl /bin/cfssl && \ sudo rm -rf /gocode && sudo rm -rf /usr/local/go # Install jwtproxy RUN curl -L -o /usr/local/bin/jwtproxy https://github.com/coreos/jwtproxy/releases/download/v0.0.1/jwtproxy-linux-x64 RUN chmod +x /usr/local/bin/jwtproxy # Install Grunt RUN ln -s /usr/bin/nodejs /usr/bin/node RUN npm install -g grunt-cli # Install Grunt depenencies ADD grunt grunt RUN cd grunt && npm install # Run grunt ADD static static RUN cd grunt && grunt 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 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/create_certs.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 # Download any external libs. RUN mkdir static/fonts static/ldn ADD external_libraries.py external_libraries.py RUN venv/bin/python -m external_libraries RUN mkdir /usr/local/nginx/logs/ # TODO(ssewell): only works on a detached head, make work with ref ADD .git/HEAD GIT_HEAD # Add all of the files! ADD . . # 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 RUN PYTHONPATH=. venv/bin/alembic heads | grep -E '^[0-9a-f]+ \(head\)$' > ALEMBIC_HEAD VOLUME ["/conf/stack", "/var/log", "/datastorage", "/tmp", "/conf/etcd"] EXPOSE 443 8443 80