FROM opensuse
ENV http_proxy http://172.17.42.1:3128/

#RUN zypper -y install deltarpm
RUN zypper --gpg-auto-import-keys -n update 
RUN zypper -n install --no-recommends git gcc make
RUN zypper -n install --no-recommends pcre-devel openssl-devel libdb-4_8-devel
RUN zypper -n install --no-recommends mysql-devel postgresql-devel 
RUN zypper -n install --no-recommends sqlite-devel openldap2-devel 
RUN zypper -n install --no-recommends autoconf sudo less net-tools

# prepare user environment for running (exim) and testing exim (eximtest)
RUN groupadd --system exim
RUN useradd --system -g exim -c 'Exim User' exim
RUN groupadd eximtest
RUN useradd --home-dir /home/eximtest -g eximtest -G exim -c 'Exim Test User' -m eximtest

# add additional files
# (sudoers, Local/Makefile)
COPY platforms/opensuse/root/ /

# add current working copy
COPY exim/ /home/eximtest/exim/

# prepare the build - files need to be owned
# by eximtest
WORKDIR /home/eximtest
RUN chown -R eximtest: .

# Build Exim
USER eximtest
WORKDIR /home/eximtest/exim/src
RUN make -j -l 1


# Prepare/Build the test-suite
WORKDIR /home/eximtest/exim/test
RUN mkdir /tmp/exim
RUN echo $PWD/test-config > /tmp/exim/trusted-configs
RUN autoconf
RUN ./configure
RUN make

## now finally run the tests
## should be done by you, manually :)
# -> full hostname

ENV PATH=/sbin:$PATH
ENTRYPOINT ["./runtest", "../src/build-Linux-x86_64/exim", "-FLAVOUR", "opensuse"]
