|
|
|
FROM node:latest
|
|
|
|
|
|
|
|
ENV HOSTNAME=${HOSTNAME:-haraka.localdomain}
|
|
|
|
ENV EMAIL=${EMAIL:-test@email.tld}
|
|
|
|
ENV USE_LETSENCRYPT=${USE_LETSENCRYPT:-false}
|
|
|
|
|
|
|
|
RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list && \
|
|
|
|
apt-get update && apt-get upgrade -y && apt-get -t jessie-backports install -y supervisor certbot cron && \
|
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
mkdir /var/log/supervisord && \
|
|
|
|
mkdir /var/run/supervisord && \
|
|
|
|
groupadd -r haraka && \
|
|
|
|
useradd --comment "Haraka Server User" \
|
|
|
|
--home /haraka \
|
|
|
|
--shell /bin/false \
|
|
|
|
--gid haraka \
|
|
|
|
-r \
|
|
|
|
-m \
|
|
|
|
haraka \
|
|
|
|
&& chown -R haraka:haraka /haraka
|
|
|
|
|
|
|
|
COPY haraka.sh /haraka.sh
|
|
|
|
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
|
|
|
COPY certbot-renew.sh /etc/cron.daily/certbot-renew.sh
|
|
|
|
|
|
|
|
RUN chmod +x /haraka.sh /etc/cron.daily/certbot-renew.sh
|
|
|
|
|
|
|
|
# Install and Haraka and it's plugins
|
|
|
|
USER node
|
|
|
|
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
|
|
|
|
ENV PATH=$PATH:/home/node/.npm-global/bin
|
|
|
|
|
|
|
|
RUN npm -g install Haraka \
|
|
|
|
&& npm -g install haraka-net-utils \
|
|
|
|
&& npm -g install haraka-plugin-rspamd \
|
|
|
|
&& npm -g install haraka-plugin-auth-ldap \
|
|
|
|
&& npm -g install haraka-plugin-rcpt-ldap
|
|
|
|
|
|
|
|
|
|
|
|
USER root
|
|
|
|
|
|
|
|
# Port 80 is used for LetsEncrypt
|
|
|
|
EXPOSE 25 80 587
|
|
|
|
|
|
|
|
VOLUME /haraka
|
|
|
|
VOLUME /etc/letsencrypt
|
|
|
|
|
|
|
|
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|