containers-rspamd/Dockerfile

55 lines
2.1 KiB
Text
Raw Normal View History

2021-10-03 23:19:00 +00:00
ARG ALPINE_VERSION=3.13.6
ARG BASE_IMAGE=sutty/monit
2022-03-08 11:40:41 +00:00
FROM ${BASE_IMAGE}:${ALPINE_VERSION}-100mb
2019-09-10 23:10:18 +00:00
MAINTAINER "f <f@sutty.nl>"
2019-09-10 23:23:34 +00:00
2022-03-08 11:40:41 +00:00
RUN sed -re "/^save \"\"/d" \
-e "s/^(appendonly) .*/\1 yes/" \
-e "s/^(maxmemory-policy) .*/\1 volatile-ttl/" \
-e "s/^(bind) .*/\1 127.0.0.1 ::1/" \
-e "s|^(dir) .*|\1 /var/lib/redis|" \
-i /etc/redis.conf
2019-09-10 23:23:34 +00:00
2020-11-17 17:58:36 +00:00
RUN apk add --no-cache rspamd rspamd-client rspamd-proxy rspamd-controller
RUN install -dm 755 /etc/rspamd/local.d
RUN install -dm 750 -o rspamd -g rspamd /var/lib/rspamd
2022-03-08 11:40:41 +00:00
RUN install -dm 750 -o redis -g redis /var/lib/redis
2020-11-17 17:58:36 +00:00
2022-03-08 11:40:41 +00:00
# TODO: Deprecate OpenDKIM, but it allow us to keep signing even if
# Rspamd is down.
2020-11-17 17:58:36 +00:00
RUN echo "enabled = false;" >> /etc/rspamd/local.d/dkim_signing.conf
# Redis
RUN echo "write_servers = \"localhost\";" >> /etc/rspamd/local.d/redis.conf
RUN echo "read_servers = \"localhost\";" >> /etc/rspamd/local.d/redis.conf
# Workers
RUN echo "bind_socket = \"*:11332\";" >> /etc/rspamd/local.d/worker-proxy.inc
RUN echo "bind_socket = \"*:11333\";" >> /etc/rspamd/local.d/worker-normal.inc
RUN echo "bind_socket = \"*:11334\";" >> /etc/rspamd/local.d/worker-controller.inc
# We don't really care about the password...
RUN echo "password = \"`rspamadm pw -p '12345678'`\";" >> /etc/rspamd/local.d/worker-controller.inc
# Options
# Rspamd doesn't seem to write a pid file and upstream not really
# helpful about it: https://github.com/rspamd/rspamd/issues/3096
# RUN echo "pid_file = \"/tmp/rspamd.pid\";" >> /etc/rspamd/local.d/options.inc
RUN echo "local_addrs = \"/etc/rspamd/local.d/maps.d/local_addrs\";" >> /etc/rspamd/local.d/options.inc
# Logging
RUN echo "type = \"syslog\";" >> /etc/rspamd/local.d/logging.inc
RUN echo "facility = \"daemon\";" >> /etc/rspamd/local.d/logging.inc
# Learn spam
RUN echo "servers = \"localhost\";" >> /etc/rspamd/local.d/classifier-bayes.conf
RUN echo "autolearn = [-5,5];" >> /etc/rspamd/local.d/classifier-bayes.conf
2022-03-08 11:40:41 +00:00
COPY ./local_addrs /etc/rspamd/local.d/maps.d/local_addrs
COPY ./monit.conf /etc/monit.d/rspamd.conf
2020-11-17 17:58:36 +00:00
EXPOSE 11332
EXPOSE 11333
EXPOSE 11334
2022-03-08 11:40:41 +00:00
VOLUME "/var/lib/redis"
2020-11-17 17:58:36 +00:00
VOLUME "/var/lib/rspamd"