aboutsummaryrefslogtreecommitdiffstats
path: root/foobar/portable/ci/docker/Dockerfile.alpine
blob: 2c7c66fceb40119245c707ce09e224b5630ff88b (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
FROM alpine:3.11 as build

# 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 \
    libevent-dev \
    libtool \
    libtool \
    linux-pam-dev \
    make \
    musl-dev \
    libressl \
    libressl-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