2017-05-30 20:53:19 +00:00
|
|
|
# vim:ft=dockerfile
|
|
|
|
|
|
|
|
FROM quay.io/quay/quay-base:latest
|
|
|
|
|
2017-05-30 21:06:09 +00:00
|
|
|
COPY . .
|
2017-05-30 20:53:19 +00:00
|
|
|
|
|
|
|
# Install python dependencies
|
2017-05-30 21:06:09 +00:00
|
|
|
RUN virtualenv --distribute venv \
|
|
|
|
&& venv/bin/pip install -r requirements.txt \
|
|
|
|
&& venv/bin/pip install -r requirements-tests.txt \
|
|
|
|
&& venv/bin/pip freeze # 07SEP2016
|
2017-05-30 20:53:19 +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
|
|
|
|
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
|
|
|
|
|
2017-05-30 21:06:09 +00:00
|
|
|
# Install front-end dependencies and Optimize our images
|
|
|
|
RUN yarn install --ignore-engines \
|
|
|
|
&& yarn build \
|
|
|
|
&& jpegoptim static/img/**/*.jpg \
|
|
|
|
&& optipng -clobber -quiet static/img/**/*.png
|
2017-05-30 20:53:19 +00:00
|
|
|
|
|
|
|
# Set up the init system
|
2017-05-30 21:06:09 +00:00
|
|
|
RUN mkdir -p /etc/my_init.d /etc/systlog-ng /usr/local/bin /etc/monit static/fonts static/ldn /usr/local/nginx/logs/ \
|
|
|
|
&& cp conf/init/*.sh /etc/my_init.d/ \
|
|
|
|
&& cp conf/init/syslog-ng.conf /etc/syslog-ng/ \
|
|
|
|
&& cp -r conf/init/service/* /etc/service \
|
|
|
|
&& cp conf/kill-buildmanager.sh /usr/local/bin/kill-buildmanager.sh \
|
|
|
|
&& cp conf/monitrc /etc/monit/monitrc \
|
|
|
|
&& chmod 0600 /etc/monit/monitrc \
|
|
|
|
&& cp conf/init/logrotate.conf /etc/logrotate.conf \
|
|
|
|
&& cp .git/HEAD GIT_HEAD \
|
|
|
|
&& rm -rf /etc/service/syslog-forwarder
|
2017-05-30 20:53:19 +00:00
|
|
|
|
|
|
|
# Run the tests
|
|
|
|
RUN if [ "$RUN_TESTS" = true ]; then \
|
|
|
|
TEST=true PYTHONPATH="." venv/bin/py.test --timeout=7200 --verbose \
|
|
|
|
--show-count -x --color=no ./ && rm -rf /var/tmp/; \
|
|
|
|
|
|
|
|
TEST=true PYTHONPATH="." venv/bin/py.test --timeout=7200 --verbose \
|
|
|
|
--show-count -x --color=no test/registry_tests.py && rm -rf /var/tmp/;\
|
2017-05-30 21:06:09 +00:00
|
|
|
yarn test; \
|
2017-05-30 20:53:19 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2017-05-30 21:06:09 +00:00
|
|
|
# Cleanup any NPM-related stuff.
|
|
|
|
# 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 \
|
|
|
|
# && apt-get autoremove -y \
|
|
|
|
# && apt-get clean
|
|
|
|
# && rm -rf /root/.npm /.npm /usr/local/lib/node_modules /usr/share/yarn/node_modules \
|
|
|
|
# /root/node_modules /node_modules /grunt
|
2017-05-30 20:53:19 +00:00
|
|
|
|
2017-05-30 21:06:09 +00:00
|
|
|
RUN PYTHONPATH=. venv/bin/alembic heads | grep -E '^[0-9a-f]+ \(head\)$' > ALEMBIC_HEAD
|