-
Notifications
You must be signed in to change notification settings - Fork 87
/
Dockerfile
94 lines (71 loc) · 2.58 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
FROM alpine:3.12
LABEL maintainer="Huan LI <[email protected]>"
ENV BATS_VERSION 1.2.1
ENV S6_VERSION 2.1.0.0
## Install System
RUN apk add --update --no-cache \
bash \
coreutils \
curl \
cyrus-sasl \
cyrus-sasl-plain \
cyrus-sasl-login \
ca-certificates \
drill \
logrotate \
opendkim \
opendkim-utils \
openssl \
postsrsd \
postfix \
postfix-pcre \
syslog-ng \
tzdata \
\
&& curl -s -o "/tmp/v${BATS_VERSION}.tar.gz" -L \
"https://github.com/bats-core/bats-core/archive/v${BATS_VERSION}.tar.gz" \
&& tar -xzf "/tmp/v${BATS_VERSION}.tar.gz" -C /tmp/ \
&& bash "/tmp/bats-core-${BATS_VERSION}/install.sh" /usr/local \
\
&& rm -rf /tmp/*
## Install s6 process manager with the current platform (arm/x86)
COPY script/install-s6-overlay.sh /app/
RUN /app/install-s6-overlay.sh "$S6_VERSION"
## Configure Service
COPY install/main.dist.cf /etc/postfix/main.cf
COPY install/master.dist.cf /etc/postfix/master.cf
COPY install/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
COPY install/opendkim.conf /etc/opendkim/opendkim.conf
COPY install/sender_header_filter.pcre /etc/postfix/sender_header_filter.pcre
RUN cat /dev/null > /etc/postfix/aliases && newaliases \
&& echo simple-mail-forwarder.com > /etc/hostname \
&& mkdir -p /run/opendkim && chown opendkim:opendkim /run/opendkim \
&& echo test | saslpasswd2 -p [email protected] \
&& chown postfix /etc/sasl2/sasldb2 \
&& saslpasswd2 -d [email protected]
## Copy App
WORKDIR /app
COPY install/init-openssl.sh /app/init-openssl.sh
RUN bash -n /app/init-openssl.sh && chmod +x /app/init-openssl.sh
COPY install/init-postsrsd.sh /app/init-postsrsd.sh
RUN bash -n /app/init-postsrsd.sh && chmod +x /app/init-postsrsd.sh
COPY install/postfix.sh /etc/services.d/postfix/run
RUN bash -n /etc/services.d/postfix/run && chmod +x /etc/services.d/postfix/run
COPY install/syslog-ng.sh /etc/services.d/syslog-ng/run
RUN bash -n /etc/services.d/syslog-ng/run && chmod +x /etc/services.d/syslog-ng/run
COPY install/opendkim.sh /etc/services.d/opendkim/run
RUN bash -n /etc/services.d/opendkim/run && chmod +x /etc/services.d/opendkim/run
COPY entrypoint.sh /entrypoint.sh
RUN bash -n /entrypoint.sh && chmod a+x /entrypoint.sh
COPY BANNER /app/
COPY VERSION /app/
COPY test /app/test
COPY .git/logs/HEAD /app/GIT_LOG
COPY .git/HEAD /app/GIT_HEAD
COPY install/buildenv.sh /app/
VOLUME ["/var/spool/postfix"]
EXPOSE 25
ENTRYPOINT ["/entrypoint.sh"]
CMD ["start"]
## Log Environment (in Builder)
RUN bash buildenv.sh