diff --git a/Dockerfile b/Dockerfile index 8bd1a157..a58178c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,9 @@ FROM golang:alpine # Install MailHog: RUN apk --no-cache add --virtual build-dependencies \ + bash \ git \ + wget \ && mkdir -p /root/gocode \ && export GOPATH=/root/gocode \ && go get github.com/mailhog/MailHog \ @@ -19,6 +21,10 @@ RUN apk --no-cache add --virtual build-dependencies \ # https://github.com/boot2docker/boot2docker/issues/581 RUN adduser -D -u 1000 mailhog +# Download wait-for-it.sh +RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh \ + && chmod a+x wait-for-it.sh + USER mailhog WORKDIR /home/mailhog diff --git a/docs/DEPLOY.md b/docs/DEPLOY.md index db00fa66..ac66d2c9 100644 --- a/docs/DEPLOY.md +++ b/docs/DEPLOY.md @@ -33,6 +33,18 @@ To mount the Maildir to the local filesystem, you can use a volume: docker run -d -e "MH_STORAGE=maildir" -v $PWD/maildir:/maildir -p 1025:1025 -p 8025:8025 mailhog/mailhog +#### MongoDB + +You can run MailHog with a MongoDB for persisting messages. In order to prevent MailHog from falling back to in-memory storage, you can override the default Docker entrypoint with the `wait-for-it.sh` command. + +**docker-compose.yml** + + services: + mailhog: + entrypoint: ["wait-for-it.sh", "mongo-db-host:27017", "--strict", "--timeout=120", "--", "MailHog"] + +This example waits 120s until a connection to the MongoDB can be established before starting MailHog. Please see https://github.com/vishnubob/wait-for-it for usage. + ### Elastic Beanstalk You can deploy MailHog using [AWS Elastic Beanstalk](http://aws.amazon.com/elasticbeanstalk/).