FROM dovecot/dovecot:latest

COPY --chown=mail:mail start.sh /
COPY --chown=mail:mail templates/ /templates/
COPY config/ /config/

RUN mkdir /run/dovecot /cert /dh && \
    chown mail:mail /config /cert /dh /run/dovecot

VOLUME /cert
VOLUME /dh

EXPOSE 10993/tcp

USER mail

CMD ["/start.sh"]