-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
57 lines (48 loc) · 1.47 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
# syntax=docker/dockerfile:1
ARG MSMTP_VERSION=1.8.27
ARG ALPINE_VERSION=3.20
ARG XX_VERSION=1.5.0
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION} AS base
COPY --from=xx / /
RUN apk --update --no-cache add clang curl file lld make musl-dev pkgconfig tar xz
ARG MSMTP_VERSION
WORKDIR /src
RUN curl -sSL "https://marlam.de/msmtp/releases/msmtp-$MSMTP_VERSION.tar.xz" | tar xJv --strip 1
FROM base AS builder
ARG TARGETPLATFORM
RUN xx-apk --no-cache --no-scripts add g++ gettext-dev gnutls-dev libidn2-dev
RUN <<EOT
set -ex
CC=xx-clang CXX=xx-clang++ ./configure --host=$(xx-clang --print-target-triple) --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j$(nproc)
make install
xx-verify /usr/bin/msmtp
xx-verify /usr/bin/msmtpd
file /usr/bin/msmtpd
EOT
FROM crazymax/alpine-s6:${ALPINE_VERSION}-2.2.0.3
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2" \
TZ="UTC" \
PUID="1500" \
PGID="1500"
RUN apk --update --no-cache add \
bash \
ca-certificates \
gettext \
gnutls \
libidn2 \
libgsasl \
libsecret \
mailx \
shadow \
tzdata \
&& ln -sf /usr/bin/msmtp /usr/sbin/sendmail \
&& addgroup -g ${PGID} msmtpd \
&& adduser -D -H -u ${PUID} -G msmtpd -s /bin/sh msmtpd \
&& rm -rf /tmp/*
COPY --from=builder /usr/bin/msmtp* /usr/bin/
COPY rootfs /
EXPOSE 2500
HEALTHCHECK --interval=10s --timeout=5s \
CMD echo EHLO localhost | nc 127.0.0.1 2500 | grep 250 || exit 1