blob: 010696447c8a99244856dd6313e5b4594692f1f7 (
plain) (
blame)
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
|
FROM alpine:3.10 as build
# Allow container to expose ports at runtime, if necessary
# https://docs.docker.com/engine/reference/#expose
EXPOSE 25
EXPOSE 465
EXPOSE 587
# creates /opensmtpd dir and makes all following commands to run in it
# https://docs.docker.com/engine/reference/builder/#workdir
WORKDIR /opensmtpd
# install necessary packages
RUN apk add --no-cache \
autoconf \
automake \
bison \
ca-certificates \
fts-dev \
gcc \
fts \
libasr-dev \
libevent-dev \
libtool \
libtool \
linux-pam-dev \
make \
musl-dev \
openssl \
openssl-dev \
zlib-dev
# create users and directories
# note: alpine uses busybox and useradd is not available there
# also long flags are not available too, so sorry for the
RUN mkdir -p /var/lib/opensmtpd/empty \
&& adduser _smtpd -h /var/lib/opensmtpd/empty/ -D -H -s /bin/false \
&& adduser _smtpq -h /var/lib/opensmtpd/empty/ -D -H -s /bin/false \
&& mkdir -p /var/spool/smtpd \
&& mkdir -p /var/mail \
&& mkdir -p /etc/mail \
&& chmod 711 /var/spool/smtpd
# Copy contentes of the repo inside the container
# https://docs.docker.com/engine/reference/builder/#copy
COPY . /opensmtpd
# build opensmtpd
RUN ./bootstrap \
&& ./configure \
--with-gnu-ld \
--sysconfdir=/etc/mail \
--with-auth-pam \
&& make \
&& make install \
&& cp etc/aliases /etc/mail/aliases
|