forked from huan/docker-simple-mail-forwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
78 lines (56 loc) · 1.95 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
FROM alpine:3.8
LABEL maintainer="Zhuohuan LI <zixia@zixia.net>"
ENV BATS_VERSION 1.1.0
ENV S6_VERSION 1.21.7.0
## Install System
RUN apk add --update --no-cache \
bash \
curl \
cyrus-sasl \
drill \
logrotate \
openssl \
postfix \
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
RUN curl -L -s https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-amd64.tar.gz \
| tar xzf - -C /
## 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
RUN cat /dev/null > /etc/postfix/aliases && newaliases \
&& echo simple-mail-forwarder.com > /etc/hostname \
\
&& echo test | saslpasswd2 -p test@test.com \
&& chown postfix /etc/sasldb2 \
&& saslpasswd2 -d test@test.com
## 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/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 entrypoint.sh /entrypoint.sh
RUN bash -n /entrypoint.sh && chmod a+x /entrypoint.sh
COPY BANNER /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