FROM fedora:21

ENV http_proxy http://172.17.42.1:3128/
ENV DEBIAN_FRONTEND noninteractive 

#RUN yum -y install deltarpm
RUN yum -y update
RUN yum -y install git gcc make
RUN yum -y install pcre-devel openssl-devel libdb-devel 
RUN yum -y install community-mysql-devel postgresql-devel 
RUN yum -y install sqlite-devel openldap-devel perl-devel 
RUN yum -y install autoconf sudo less net-tools
Run yum -y install perl-ExtUtils-Embed 

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

# add additional files
# (sudoers, Local/Makefile)
COPY platforms/fedora21/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", "fedora21"]
