FROM debian:stretch

ADD https://raw.githubusercontent.com/docker-gcf/docker-gcf/v1.5.0/setup.sh /tmp/docker-utils-setup.sh
RUN sh /tmp/docker-utils-setup.sh
ENTRYPOINT ["gcf-entrypoint"]
CMD ["run.sh"]

ENV POSTFIX_VERSION=3.1.*

RUN groupadd -r email --gid=7788 && useradd -r -g email --uid=7788 email &&\
    echo "postfix postfix/main_mailer_type string Internet site" > preseed.txt &&\
    echo "postfix postfix/mailname string mail.example.com" >> preseed.txt &&\
    debconf-set-selections preseed.txt &&\
    pkgs-install postfix=${POSTFIX_VERSION} postfix-pgsql=${POSTFIX_VERSION} postfix-ldap=${POSTFIX_VERSION} rsyslog

COPY ./bin /usr/local/bin/
COPY ./config /etc/salt/base/
