FROM debian:jessie

MAINTAINER Robin Thoni <robin@rthoni.com>

RUN apt-get update &&\
    apt-get install -y gcc g++ cmake libssl-dev libjsoncpp-dev libmilter-dev git &&\
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN git clone https://git.rthoni.com/robin.thoni/milter-sasl &&\
    cd milter-sasl &&\
    mkdir build && cd build &&\
    cmake .. && make &&\
    cp src/milter-sasl /usr/local/bin

RUN rm -rf /var/log/* &&\
    mkfifo /var/log/syslog &&\
    ln -s /dev/null /var/log/mail.log &&\
    ln -s /dev/null /var/log/mail.err &&\
    ln -s /dev/null /var/log/main.info &&\
    ln -s /dev/null /var/log/messages

COPY ./config /etc/milter-sasl/

COPY ./vars-vars /etc/vars-vars

COPY ./vars-files /etc/vars-files

COPY ./run.sh /run.sh

CMD ["/run.sh"]
