mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +00:00
More Docker work
- Dockerfile now builds Inbucket inside the container - Add starter inbucket.conf for Docker - Add install.sh to build inbucket inside container - Add customized greeting.html for Docker
This commit is contained in:
27
Dockerfile
27
Dockerfile
@@ -3,21 +3,16 @@
|
|||||||
FROM crosbymichael/golang
|
FROM crosbymichael/golang
|
||||||
MAINTAINER James Hillyerd, @jameshillyerd
|
MAINTAINER James Hillyerd, @jameshillyerd
|
||||||
|
|
||||||
# Install Inbucket
|
# Configuration (WORKDIR doesn't support env vars)
|
||||||
|
ENV INBUCKET_SRC $GOPATH/src/github.com/jhillyerd/inbucket
|
||||||
ENV INBUCKET_HOME /opt/inbucket
|
ENV INBUCKET_HOME /opt/inbucket
|
||||||
ADD inbucket $INBUCKET_HOME/inbucket
|
|
||||||
ADD themes $INBUCKET_HOME/themes
|
|
||||||
ADD etc/unix-sample.conf $INBUCKET_HOME/inbucket.conf
|
|
||||||
|
|
||||||
# Volume for mail data
|
|
||||||
VOLUME /var/opt/inbucket
|
|
||||||
|
|
||||||
# SMTP, HTTP, POP3 ports
|
|
||||||
EXPOSE 25
|
|
||||||
EXPOSE 80
|
|
||||||
EXPOSE 110
|
|
||||||
|
|
||||||
# Start Inbucket (WORKDIR doesn't support env vars)
|
|
||||||
WORKDIR /opt/inbucket
|
WORKDIR /opt/inbucket
|
||||||
ENTRYPOINT ["./inbucket"]
|
ENTRYPOINT ["bin/inbucket"]
|
||||||
CMD ["inbucket.conf"]
|
CMD ["/etc/opt/inbucket.conf"]
|
||||||
|
|
||||||
|
# Ports: SMTP, HTTP, POP3
|
||||||
|
EXPOSE 10025 10080 10110
|
||||||
|
|
||||||
|
# Build Inbucket
|
||||||
|
ADD . $INBUCKET_SRC/
|
||||||
|
RUN "$INBUCKET_SRC/etc/docker/install.sh"
|
||||||
|
|||||||
9
docker-run.sh
Executable file
9
docker-run.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# docker-run.sh
|
||||||
|
# description: Launch Inbucket's docker image
|
||||||
|
|
||||||
|
if [ "$UID" -ne 0 ]; then
|
||||||
|
sudo $0 "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker run -p 9000:10080 -p 2500:10025 -p 1100:10110 jhillyerd/inbucket
|
||||||
15
etc/docker/greeting.html
Normal file
15
etc/docker/greeting.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<p>Inbucket is an email testing service; it will accept email for any email
|
||||||
|
address and make it available to view without a password.</p>
|
||||||
|
|
||||||
|
<p>To view email for a particular address, enter the username portion
|
||||||
|
of the address into the box on the upper right and click <em>go</em>.</p>
|
||||||
|
|
||||||
|
<p>This instance of Inbucket is running inside of a <a
|
||||||
|
href="https://www.docker.io/" target="_blank">Docker</a> container. It is
|
||||||
|
configured to retain messages for a maximum of 3 days, and will enforce a limit
|
||||||
|
of 300 messages per mailbox - the oldest messages will be deleted to stay under
|
||||||
|
the limit.</p>
|
||||||
|
|
||||||
|
<p>Messages addressed to any recipient in the <code>@bitbucket.local</code>
|
||||||
|
domain will be accepted but not written to disk. Use this domain for load or
|
||||||
|
soak testing your application.</p>
|
||||||
110
etc/docker/inbucket.conf
Normal file
110
etc/docker/inbucket.conf
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
# inbucket.conf
|
||||||
|
# Configuration for Inbucket inside of Docker
|
||||||
|
#
|
||||||
|
# These should be reasonable defaults for a production install of Inbucket
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
[DEFAULT]
|
||||||
|
|
||||||
|
# Not used directly, but is typically referenced below in %()s format.
|
||||||
|
install.dir=/opt/inbucket
|
||||||
|
domain=inbucket.local
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
[logging]
|
||||||
|
|
||||||
|
# Options from least to most verbose: ERROR, WARN, INFO, TRACE
|
||||||
|
level=INFO
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
[smtp]
|
||||||
|
|
||||||
|
# IPv4 address to listen for SMTP connections on.
|
||||||
|
ip4.address=0.0.0.0
|
||||||
|
|
||||||
|
# IPv4 port to listen for SMTP connections on.
|
||||||
|
ip4.port=10025
|
||||||
|
|
||||||
|
# used in SMTP greeting
|
||||||
|
domain=inbucket.local
|
||||||
|
|
||||||
|
# optional: mail sent to accounts at this domain will not be stored,
|
||||||
|
# for mixed use (content and load testing)
|
||||||
|
domain.nostore=bitbucket.local
|
||||||
|
|
||||||
|
# Maximum number of RCPT TO: addresses we allow from clients, the SMTP
|
||||||
|
# RFC recommends this be at least 100.
|
||||||
|
max.recipients=100
|
||||||
|
|
||||||
|
# How long we allow a network connection to be idle before hanging up on the
|
||||||
|
# client, SMTP RFC recommends at least 5 minutes (300 seconds).
|
||||||
|
max.idle.seconds=300
|
||||||
|
|
||||||
|
# Maximum allowable size of message body in bytes (including attachments)
|
||||||
|
max.message.bytes=2048000
|
||||||
|
|
||||||
|
# Should we place messages into the datastore, or just throw them away
|
||||||
|
# (for load testing): true or false
|
||||||
|
store.messages=true
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
[pop3]
|
||||||
|
|
||||||
|
# IPv4 address to listen for POP3 connections on.
|
||||||
|
ip4.address=0.0.0.0
|
||||||
|
|
||||||
|
# IPv4 port to listen for POP3 connections on.
|
||||||
|
ip4.port=10110
|
||||||
|
|
||||||
|
# used in POP3 greeting
|
||||||
|
domain=%(domain)
|
||||||
|
|
||||||
|
# How long we allow a network connection to be idle before hanging up on the
|
||||||
|
# client, POP3 RFC requires at least 10 minutes (600 seconds).
|
||||||
|
max.idle.seconds=600
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
[web]
|
||||||
|
|
||||||
|
# IPv4 address to serve HTTP web interface on
|
||||||
|
ip4.address=0.0.0.0
|
||||||
|
|
||||||
|
# IPv4 port to serve HTTP web interface on
|
||||||
|
ip4.port=10080
|
||||||
|
|
||||||
|
# Name of web theme to use
|
||||||
|
theme=integral
|
||||||
|
|
||||||
|
# Path to the selected themes template files
|
||||||
|
template.dir=%(install.dir)s/themes/%(theme)s/templates
|
||||||
|
|
||||||
|
# Should we cache parsed templates (set to false during theme dev)
|
||||||
|
template.cache=true
|
||||||
|
|
||||||
|
# Path to the selected themes public (static) files
|
||||||
|
public.dir=%(install.dir)s/themes/%(theme)s/public
|
||||||
|
|
||||||
|
# Path to the greeting HTML displayed on front page, can
|
||||||
|
# be moved out of installation dir for customization
|
||||||
|
greeting.file=/etc/opt/inbucket-greeting.html
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
[datastore]
|
||||||
|
|
||||||
|
# Path to the datastore, mail will be written into subdirectories
|
||||||
|
path=/var/opt/inbucket
|
||||||
|
|
||||||
|
# How many minutes after receipt should a message be stored until it's
|
||||||
|
# automatically purged. To retain messages until manually deleted, set this
|
||||||
|
# to 0
|
||||||
|
retention.minutes=4320
|
||||||
|
|
||||||
|
# How many milliseconds to sleep after purging messages from a mailbox.
|
||||||
|
# This should help reduce disk I/O when there are a large number of messages
|
||||||
|
# to purge.
|
||||||
|
retention.sleep.millis=100
|
||||||
|
|
||||||
|
# Maximum number of messages we will store in a single mailbox. If this
|
||||||
|
# number is exceeded, the oldest message in the box will be deleted each
|
||||||
|
# time a new message is received for it.
|
||||||
|
mailbox.message.cap=300
|
||||||
33
etc/docker/install.sh
Executable file
33
etc/docker/install.sh
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# install.sh
|
||||||
|
# description: Build, test, and install Inbucket. Should be executed inside a Docker container.
|
||||||
|
|
||||||
|
# Note: we assume there are no spaces in dir paths
|
||||||
|
installdir=${INBUCKET_HOME}
|
||||||
|
srcdir=${INBUCKET_SRC}
|
||||||
|
bindir=$installdir/bin
|
||||||
|
|
||||||
|
# Setup
|
||||||
|
export GOBIN=$bindir
|
||||||
|
builddate="$(date --iso-8601=seconds)"
|
||||||
|
set -e
|
||||||
|
cd $srcdir
|
||||||
|
go clean
|
||||||
|
|
||||||
|
# Build
|
||||||
|
echo "### Fetching Dependencies"
|
||||||
|
go get -d -v ./...
|
||||||
|
go get -v github.com/stretchr/testify
|
||||||
|
|
||||||
|
echo "### Testing Inbucket"
|
||||||
|
go test ./...
|
||||||
|
|
||||||
|
echo "### Building Inbucket"
|
||||||
|
mkdir -p $bindir
|
||||||
|
go build -o inbucket -race -ldflags "-X main.BUILD_DATE '$builddate'" -v .
|
||||||
|
|
||||||
|
echo "### Installing Inbucket"
|
||||||
|
mv inbucket $bindir
|
||||||
|
install etc/docker/inbucket.conf /etc/opt/inbucket.conf
|
||||||
|
install etc/docker/greeting.html /etc/opt/inbucket-greeting.html
|
||||||
|
cp -r themes $installdir/
|
||||||
Reference in New Issue
Block a user