FROM debian:9
MAINTAINER Jean Gabes <naparuba@gmail.com>

RUN        apt-get update && apt-get install -y python
# Setup test env, "standard" installation is test with other tests ^^
RUN        apt-get install -y python-pip
RUN        pip install jinja2
RUN        pip install leveldb
RUN        pip install pyOpenSSL
RUN        pip install pycrypto
RUN        pip install requests
RUN        pip install Crypto
RUN        pip install pygments
RUN        pip install coveralls
RUN        pip install nose-cov
RUN        pip install unittest2
RUN        apt-get install -y python-cherrypy3
RUN        pip install rsa
# The internal yaml seems to not be used, thanks nose
RUN        pip install ruamel.yaml==0.11.15
RUN        apt-get install -y sysstat
# We need a dummy test to exit WARNING and be sure email is launched
RUN        apt-get install -y nagios-plugins-standard

# We will need postfix for this test
RUN        DEBIAN_FRONTEND=noninteractive apt-get install -qy postfix


ADD        . /root/opsbro-oss
WORKDIR       /root/opsbro-oss

# install to allow the directory to exists
RUN       python setup.py install

# Copy the mail pack into a local one to enable modification
RUN        opsbro  packs overload global.mail
# Modify the value
RUN        opsbro packs parameters set local.mail.enabled true

# Copy the new checks
ADD        test/test-files/test-mail-handlers   /var/lib/opsbro/global-configuration/packs/

ENTRYPOINT     /etc/init.d/postfix start; test/test_one_linux_installation.sh   && test/test_email_handlers.sh
