blob: a53011357461deb131fe0fb7922d993b43bd4ce6 (
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
|
FROM ubuntu:latest
# 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 apt update \
&& apt install -y --no-install-recommends \
autoconf \
automake \
bison \
build-essential \
libasr-dev \
libevent-dev \
libssl-dev \
libtool \
libpam0g-dev \
zlib1g-dev
# create users and directories
RUN mkdir -p /var/lib/opensmtpd/empty \
&& useradd _smtpd \
--home-dir /var/lib/opensmtpd/empty \
--no-create-home \
--shell /bin/false \
&& useradd _smtpq \
--home-dir /var/lib/opensmtpd/empty \
--no-create-home \
--shell /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
RUN ./bootstrap \
&& ./configure \
--with-gnu-ld \
--sysconfdir=/etc/mail \
--with-auth-pam \
&& make \
&& make install \
&& cp etc/aliases /etc/mail/aliases
|