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 ["dovecot", "-F"]

ENV DOVECOT_VERSION=1:2.2.*

RUN groupadd -r email --gid=7788 && useradd -r -g email --uid=7788 email &&\
    pkgs-install dovecot-imapd=${DOVECOT_VERSION} dovecot-sieve=${DOVECOT_VERSION} dovecot-managesieved=${DOVECOT_VERSION} \
                 dovecot-pgsql=${DOVECOT_VERSION} dovecot-ldap=${DOVECOT_VERSION} dovecot-lmtpd=${DOVECOT_VERSION}

COPY ./config /etc/salt/base/
