parent
fd8b624d7c
commit
4d795224ae
@ -0,0 +1,38 @@ |
|||||||
|
FROM node:latest |
||||||
|
|
||||||
|
ENV HOSTNAME=${HOSTNAME:-haraka} |
||||||
|
|
||||||
|
RUN apt-get update && apt-get upgrade -y && apt-get install -y supervisor certbot && \ |
||||||
|
rm -rf /var/lib/apt/lists/* && \ |
||||||
|
mkdir /var/log/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 cron.sh /cron.sh |
||||||
|
COPY haraka.sh /run.sh |
||||||
|
COPY supervisord.conf /etc/supervisor/supervisord.conf |
||||||
|
|
||||||
|
RUN chmod +x /cron.sh /haraka.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-plugin-rspamd |
||||||
|
|
||||||
|
|
||||||
|
# Port 80 is used for LetsEncrypt |
||||||
|
EXPOSE 25 80 587 |
||||||
|
|
||||||
|
VOLUME /haraka |
||||||
|
|
||||||
|
ENTRYPOINT ["/run.sh"] |
@ -0,0 +1,11 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
# Generate config |
||||||
|
if [ ! -f /haraka/config/smtp.ini ]; then |
||||||
|
haraka -i /haraka |
||||||
|
fi |
||||||
|
|
||||||
|
# Specify hostname |
||||||
|
echo $HOSTNAME > /haraka/config/me |
||||||
|
|
||||||
|
haraka -c /haraka |
@ -0,0 +1,22 @@ |
|||||||
|
[supervisord] |
||||||
|
nodaemon=true |
||||||
|
logfile=/var/log/supervisord/supervisord.log |
||||||
|
pidfile=/var/run/supervisord/supervisord.pid |
||||||
|
childlogdir=/var/log/supervisord/ |
||||||
|
logfile_maxbytes=50MB ; maximum size of logfile before rotation |
||||||
|
logfile_backups=10 ; number of backed up logfiles |
||||||
|
loglevel=error |
||||||
|
|
||||||
|
[program:haraka] |
||||||
|
stdout_logfile=/dev/stdout |
||||||
|
stdout_logfile_maxbytes=0 |
||||||
|
stderr_logfile=/dev/stderr |
||||||
|
stderr_logfile_maxbytes=0 |
||||||
|
command=/haraka.sh |
||||||
|
|
||||||
|
[program:cron] |
||||||
|
stdout_logfile=/dev/stdout |
||||||
|
stdout_logfile_maxbytes=0 |
||||||
|
stderr_logfile=/dev/stderr |
||||||
|
stderr_logfile_maxbytes=0 |
||||||
|
command=/cron.sh |
Loading…
Reference in new issue