mirror of
https://gitlab.com/ric_harvey/MailHog.git
synced 2024-11-23 22:34:04 +00:00
12eb3dfb7d
Installs ca-certificates, required for the "release message" feature. With the current [mailhog/mailhog](https://hub.docker.com/r/mailhog/mailhog/) docker image, releasing messages to an SMTP server via TLS fails: > Failed to release message: x509: failed to load system roots and no roots > provided Removes any build dependencies after install, optimising docker image size. The image size is about the same as the Rocker based build, but works with plain Docker and can therefore be used via Docker Hub Automated Builds. Runs with a non-privileged user account instead of as root, increasing security. Assigning the user ID 1000 allows host volume mounts (e.g. for maildir storage) to work seamlessly with docker-machine. Installs MailHog in `/usr/local/bin`, which is in the system `PATH` and allows to use a simplified entrypoint (`MailHog`).
34 lines
773 B
Docker
34 lines
773 B
Docker
#
|
|
# MailHog Dockerfile
|
|
#
|
|
|
|
FROM alpine:3.4
|
|
|
|
# Install ca-certificates, required for the "release message" feature:
|
|
RUN apk --no-cache add \
|
|
ca-certificates
|
|
|
|
# Install MailHog:
|
|
RUN apk --no-cache add --virtual build-dependencies \
|
|
go \
|
|
git \
|
|
&& mkdir -p /root/gocode \
|
|
&& export GOPATH=/root/gocode \
|
|
&& go get github.com/mailhog/MailHog \
|
|
&& mv /root/gocode/bin/MailHog /usr/local/bin \
|
|
&& rm -rf /root/gocode \
|
|
&& apk del --purge build-dependencies
|
|
|
|
# Add mailhog user/group with uid/gid 1000.
|
|
# This is a workaround for boot2docker issue #581, see
|
|
# https://github.com/boot2docker/boot2docker/issues/581
|
|
RUN adduser -D -u 1000 mailhog
|
|
|
|
USER mailhog
|
|
|
|
WORKDIR /home/mailhog
|
|
|
|
ENTRYPOINT ["MailHog"]
|
|
|
|
# Expose the SMTP and HTTP ports:
|
|
EXPOSE 1025 8025
|