You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.4 KiB
73 lines
1.4 KiB
###
|
|
### Meta Information
|
|
###
|
|
FROM localhost/debian
|
|
|
|
# deploy options
|
|
# -p (port) and -v (volume) both go host:container
|
|
LABEL deployopts="\
|
|
-p 25:25 \
|
|
-p 587:587 \
|
|
-p 143:143 \
|
|
-p 993:993 \
|
|
-v /srv/volumes/mailsrv/db:/vol/db \
|
|
-v /srv/volumes/mailsrv/mail:/vol/mail \
|
|
-v /srv/volumes/mailsrv/ssl:/vol/ssl:ro"
|
|
|
|
# Build Variables
|
|
# uid that the files owner user should have
|
|
ARG FILESUID=5000
|
|
|
|
###
|
|
### General Setup
|
|
###
|
|
|
|
# tell debian not to ask questions during install process
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
# install packages we want
|
|
RUN apt update -y && apt install -y rsyslog postfix dovecot-imapd dovecot-lmtpd dovecot-sieve
|
|
|
|
# add virtual mail user
|
|
RUN addgroup --gid ${FILESUID:?} vmail && \
|
|
adduser vmail --ingroup vmail --uid ${FILESUID:?} --disabled-password --gecos "Virtual Mail Owner" --shell /usr/sbin/nologin --no-create-home --home /var/mail/virtual
|
|
|
|
# copy our custom scripts
|
|
COPY assets/bin /usr/local/bin
|
|
|
|
###
|
|
### mkvirtual
|
|
###
|
|
|
|
# copy mkvirtual service
|
|
COPY assets/mkvirtual.service /etc/systemd/system/
|
|
|
|
# enable service
|
|
RUN systemctl enable mkvirtual.service
|
|
|
|
###
|
|
### Postfix
|
|
###
|
|
|
|
# copy postfix config
|
|
COPY assets/postfix /etc/postfix
|
|
|
|
###
|
|
### Dovecot
|
|
###
|
|
|
|
# copy dovecot config
|
|
COPY assets/dovecot /etc/dovecot
|
|
|
|
# make symlink to mail dir
|
|
RUN ln -s /vol/mail /var/mail/virtual
|
|
|
|
###
|
|
### Working Directory
|
|
###
|
|
|
|
# make sure /vol/db exists
|
|
RUN mkdir -p /vol/db
|
|
|
|
# set /vol/db as working directory
|
|
WORKDIR /vol/db
|