help run mox with docker

in the Dockerfile, allow running on privileged ports and expose those ports.

add a docker-compose.yml with instructions for the quickstart.

fix running imaptest somewhat. after a short while it will hit the rate limiter.

in quickstart, recognize we are running under docker, and print slightly
different commands to set permissions, and skip generating the systemd service
file. als fix cleaning up the right paths during failure in quickstart.

for issue #3
This commit is contained in:
Mechiel Lukkien
2023-02-24 14:16:51 +01:00
parent 210fd34702
commit b1dcd73ebe
8 changed files with 104 additions and 34 deletions

View File

@ -1,11 +1,33 @@
FROM golang:1-alpine AS build
WORKDIR /build
RUN apk add make
COPY . .
env GOPROXY=off
RUN make build
RUN GOPROXY=off CGO_ENABLED=0 go build -trimpath
FROM alpine:3.17
# Using latest may break at some point, but will hopefully be convenient most of the time.
FROM alpine:latest
WORKDIR /mox
COPY --from=build /build/mox /mox/mox
CMD ["/mox/mox", "serve"]
COPY --from=build /build/mox /bin/mox
RUN apk add --no-cache libcap-utils
# Allow binding to privileged ports, <1024.
RUN setcap 'cap_net_bind_service=+ep' /bin/mox
# SMTP for incoming message delivery.
EXPOSE 25/tcp
# SMTP/submission with TLS.
EXPOSE 465/tcp
# SMTP/submission without initial TLS.
EXPOSE 587/tcp
# HTTP for internal account and admin pages.
EXPOSE 80/tcp
# HTTPS for ACME (Let's Encrypt), MTA-STS and autoconfig.
EXPOSE 443/tcp
# IMAP with TLS.
EXPOSE 993/tcp
# IMAP without initial TLS.
EXPOSE 143/tcp
# Prometheus metrics.
EXPOSE 8010/tcp
CMD ["/bin/mox", "serve"]