-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·92 lines (87 loc) · 3.29 KB
/
Copy pathDockerfile
File metadata and controls
executable file
·92 lines (87 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ARG ARCH=
FROM ${ARCH}debian:trixie-slim
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.license="GNU GPL-3.0" \
org.label-schema.name=spamassassin \
org.label-schema.vcs-ref=$VCS_REF
SHELL ["/bin/bash", "-c"]
#Set Environment Variables
ENV DEBIAN_FRONTEND=noninteractive \
TZ=UTC \
CRON_HOUR=1 CRON_MINUTE=30 \
HAM_BATCH_SIZE=50 SPAM_BATCH_SIZE=50 FILTER_BATCH_SIZE=50 \
MAX_MAIL_SIZE=120000 \
USERNAME=debian-spamd \
EXTRA_OPTIONS=--nouser-config \
PYZOR_SITE=public.pyzor.org:24441 \
DETAILED_LOGGING="false" \
LIST_FOLDERS="false" \
INTERVAL_MINUTES=1
#Set Versions of used Software
ARG SPAMC_VERSION=4.0.1-5
ARG SPAMD_VERSION=4.0.1-5
ARG DCC_VERSION=2.3.169
ARG PYZOR_VERSION=1:1.1.2-1
ARG RAZOR_VERSION=1:2.85-11
ARG IMAPFILTER_VERSION=1:2.8.2+1-0.2+b1
ARG ISBG_VERSION=2.3.1
ARG ISBG_SHA=c51ac52864f8275d9db6bf106b0b9aa850216dc4b059e58e069f07206aeac78b
ARG SPAMD_UID=783
ARG PYTHON_VERSION=3.13.5-1
#Install Dependencies
RUN apt-get update && \
apt-get -y --no-install-recommends install \
wget ca-certificates cron curl gcc libc6-dev libdbd-mysql-perl \
libmail-dkim-perl libnet-ident-perl make gpg gpg-agent \
python3=$PYTHON_VERSION \
python3-pip python3-venv \
pyzor=$PYZOR_VERSION \
razor=$RAZOR_VERSION \
imapfilter=$IMAPFILTER_VERSION \
spamd=$SPAMD_VERSION \
spamc=$SPAMC_VERSION && \
wget -O /root/dcc.tar.Z "https://www.dcc-servers.net/src/dcc/old/dcc-$DCC_VERSION.tar.Z" && \
tar xfvz /root/dcc.tar.Z -C /root/ && \
cd -- "/root/dcc-$DCC_VERSION" && \
CFLAGS="-O2 -fstack-protector" DCC_CFLAGS="-O2 -fstack-protector" ./configure --homedir=/var/lib/spamassassin/.dcc && make && make install && \
cd /root/
# Install Spamassassin
RUN usermod --uid $SPAMD_UID $USERNAME && \
usermod --shell /bin/bash $USERNAME && \
usermod --home /var/lib/spamassassin $USERNAME && \
rm /etc/mail/spamassassin/local.cf && \
# Spamassassin daemon config
rm -f /etc/default/spamd && echo "ENABLED=1" >> /etc/default/spamd
# Install ISBG
RUN mkdir /usr/local/pythonVenv && \
python3 -m venv /usr/local/pythonVenv && \
source /usr/local/pythonVenv/bin/activate && \
python3 -m pip install isbg==$ISBG_VERSION && \
mkdir /root/imapfilter/
# Configure Razor
RUN sed -i 's/^logfile = .*$/logfile = \/dev\/stderr/g' \
/etc/razor/razor-agent.conf
# cleanup
RUN python3 -m pip cache purge && \
apt-get purge -y binutils libgcc-12-dev libc6-dev python-pip-whl python3-setuptools python3-pkg-resources python3-wheel \
linux-libc-dev make wget && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/log/* && \
rm -rf /root/.cache/* && \
rm -rf "/root/dcc-$DCC_VERSION" && \
rm -f /root/dcc.tar.Z
# add imapfilter files
COPY imapfilterExec/* /root/imapfilter/
COPY spamassassinConf/* /etc/mail/spamassassin/
COPY scripts/* /root/
RUN rm /usr/local/pythonVenv/lib/python3.13/site-packages/isbg/imaputils.py
RUN chmod +x /root/*.sh
COPY isbg/* /usr/local/pythonVenv/lib/python3.13/site-packages/isbg/
VOLUME ["/var/lib/spamassassin"]
VOLUME ["/var/lib/mailaccounts"]
ENTRYPOINT ["/root/startup.sh"]
HEALTHCHECK --interval=1m --timeout=10s --start-period=5m \
CMD /root/status.sh