FROM alpine:latest
RUN apk add --no-cache \
dovecot \
dovecot-ldap
RUN sed -i 's/#!include auth-ldap.conf.ext/!include auth-ldap.conf.ext/' /etc/dovecot/conf.d/10-auth.conf \
&& sed -i 's/!include auth-passwdfile.conf.ext/#!include auth-passwdfile.conf.ext/' /etc/dovecot/conf.d/10-auth.conf \
&& sed -i 's/#first_valid_uid = .*/first_valid_uid = 100/g' /etc/dovecot/conf.d/10-mail.conf \
&& sed -i 's/#last_valid_uid = .*/last_valid_uid = 100/g' /etc/dovecot/conf.d/10-mail.conf
RUN addgroup -S vmail \
&& adduser -S -g '' -H -D -h /var/vmail vmail vmail
COPY 10-master.conf /etc/dovecot/conf.d/10-master.conf
COPY 10-logging.conf /etc/dovecot/conf.d/10-logging.conf
COPY auth-ldap.conf.ext /etc/dovecot/conf.d/auth-ldap.conf.ext
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
VOLUME ["/var/lib/dovecot"]
VOLUME ["/var/vmail"]
EXPOSE 143