-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
110 lines (96 loc) · 3.27 KB
/
Dockerfile
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# AUTOMATICALLY GENERATED
# DO NOT EDIT THIS FILE DIRECTLY, USE /Dockerfile.tmpl.php
# https://hub.docker.com/_/alpine
FROM alpine:3.20
ARG s6_overlay_ver=3.2.0.0
# Build and install OpenDMARC
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
ca-certificates \
&& update-ca-certificates \
\
# Install OpenDMARC dependencies
&& apk add --no-cache \
libmilter libspf2 \
msmtp \
\
# Install tools for building
&& apk add --no-cache --virtual .tool-deps \
autoconf automake coreutils curl g++ libtool make \
\
# Install OpenDMARC build dependencies
&& apk add --no-cache --virtual .build-deps \
libmilter-dev libspf2-dev \
\
# Download and prepare OpenDMARC sources
&& curl -fL -o /tmp/opendmarc.tar.gz \
https://github.com/trusteddomainproject/OpenDMARC/archive/refs/tags/rel-opendmarc-1-4-2.tar.gz \
&& tar -xzf /tmp/opendmarc.tar.gz -C /tmp/ \
&& cd /tmp/OpenDMARC-* \
# Patch NETDB_* musl libc problem.
# Details: https://github.com/instrumentisto/docker-mailserver/issues/4
&& sed -i '1s;^;#if !defined(NETDB_INTERNAL)\n# define NETDB_INTERNAL (-1)\n#endif\n#if !defined(NETDB_SUCCESS)\n# define NETDB_SUCCESS (0)\n#endif\n\n;' \
libopendmarc/opendmarc_internal.h \
\
# Build OpenDMARC from sources
&& autoreconf -v -i \
&& ./configure \
--prefix=/usr \
--sysconfdir=/etc/opendmarc \
--with-spf \
--with-spf2-lib=/usr/lib \
--with-spf2-include=/usr/include/spf2 \
# No documentation included to keep image size smaller
--docdir=/tmp/opendmarc/doc \
--infodir=/tmp/opendmarc/info \
--mandir=/tmp/opendmarc/man \
&& make \
\
# Create OpenDMARC user and group
&& addgroup -S -g 91 opendmarc \
&& adduser -S -u 90 -D -s /sbin/nologin \
-H -h /run/opendmarc \
-G opendmarc -g opendmarc \
opendmarc \
&& addgroup opendmarc mail \
\
# Install OpenDMARC
&& make install \
# Prepare run directory
&& install -d -o opendmarc -g opendmarc /run/opendmarc/ \
# Preserve licenses
&& install -d /usr/share/licenses/opendmarc/ \
&& mv /tmp/opendmarc/doc/LICENSE* \
/usr/share/licenses/opendmarc/ \
# Prepare configuration directories
&& install -d /etc/opendmarc/conf.d/ \
\
# Cleanup unnecessary stuff
&& apk del .tool-deps .build-deps \
&& rm -rf /var/cache/apk/* \
/tmp/*
# Install s6-overlay
RUN apk add --update --no-cache --virtual .tool-deps \
curl \
&& curl -fL -o /tmp/s6-overlay-noarch.tar.xz \
https://github.com/just-containers/s6-overlay/releases/download/v${s6_overlay_ver}/s6-overlay-noarch.tar.xz \
&& curl -fL -o /tmp/s6-overlay-bin.tar.xz \
https://github.com/just-containers/s6-overlay/releases/download/v${s6_overlay_ver}/s6-overlay-x86_64.tar.xz \
&& tar -xf /tmp/s6-overlay-noarch.tar.xz -C / \
&& tar -xf /tmp/s6-overlay-bin.tar.xz -C / \
\
# Cleanup unnecessary stuff
&& apk del .tool-deps \
&& rm -rf /var/cache/apk/* \
/tmp/*
ENV S6_KEEP_ENV=1 \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_CMD_WAIT_FOR_SERVICES=1 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=5000
COPY rootfs /
RUN chmod +x /etc/s6-overlay/s6-rc.d/*/run \
/etc/s6-overlay/s6-rc.d/*/*.sh
EXPOSE 8893
ENTRYPOINT ["/init"]
CMD ["opendmarc", "-f"]