opensmtpd-alpine-docker/Dockerfile
Memiks 6efe643f85
All checks were successful
continuous-integration/drone/push Build is passing
add tasks and correct dockerfile to alpine
2019-12-08 03:23:31 +09:00

73 lines
1.7 KiB
Docker

FROM alpine
LABEL Maintainer="Memiks <contact@memiks.fr>" \
Description="Lightweight container with OpenSMTPD on Alpine Linux."
# Allow container to expose ports at runtime, if necessary
# https://docs.docker.com/engine/reference/#expose
EXPOSE 25
EXPOSE 465
EXPOSE 587
# 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 \
git
# 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
WORKDIR /tmp
RUN git clone -b portable git://github.com/OpenSMTPD/OpenSMTPD.git opensmtpd
WORKDIR /tmp/opensmtpd
RUN ./bootstrap \
&& ./configure \
--prefix=/usr \
--sbindir=/usr/bin \
--libexecdir=/usr/lib/smtpd \
--sysconfdir=/etc/smtpd \
--with-user-smtpd=smtpd \
--with-user-queue=smtpq \
--with-group-queue=smtpq \
--with-gnu-ld \
--with-auth-pam
RUN make && make install
#RUN etc/aliases /etc/mail/aliases
RUN addgroup smtpq
RUN adduser -D -S -G smtpq smtpq
RUN addgroup smtpd
RUN adduser -D -S -G smtpd smtpd
USER smtpd
WORKDIR /etc/smtpd
# Override shell for bash-y debugging goodness
SHELL ["/bin/bash", "-exc"]