mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-18 18:07:22 +01:00
dockerize (work in progress)
Docker support was initially worked on in 2bbb7a5e7e, but it never really worked.
This extends f7d7434012800c3572049af82a501743d4aed583 which was an old branch for docker work.
This commit is contained in:
82
containers/docker/apt_package_list.txt
Normal file
82
containers/docker/apt_package_list.txt
Normal file
@@ -0,0 +1,82 @@
|
||||
bc
|
||||
bind9
|
||||
ca-certificates
|
||||
coreutils
|
||||
cron
|
||||
curl
|
||||
dbconfig-common
|
||||
dovecot-antispam
|
||||
dovecot-core
|
||||
dovecot-imapd
|
||||
dovecot-lmtpd
|
||||
dovecot-managesieved
|
||||
dovecot-sieve
|
||||
dovecot-sqlite
|
||||
duplicity
|
||||
fail2ban
|
||||
git
|
||||
haveged
|
||||
ldnsutils
|
||||
libapr1
|
||||
libawl-php
|
||||
libcurl4-openssl-dev
|
||||
libjs-jquery
|
||||
libjs-jquery-mousewheel
|
||||
libmagic1
|
||||
libtool
|
||||
libyaml-dev
|
||||
links
|
||||
memcached
|
||||
nginx
|
||||
nsd
|
||||
ntp
|
||||
opendkim
|
||||
opendkim-tools
|
||||
opendmarc
|
||||
openssh-client
|
||||
openssl
|
||||
php-apc
|
||||
php-auth
|
||||
php-crypt-gpg
|
||||
php-mail-mime
|
||||
php-net-sieve
|
||||
php-net-smtp
|
||||
php-net-socket
|
||||
php-pear
|
||||
php-soap
|
||||
php-xml-parser
|
||||
php5
|
||||
php5-cli
|
||||
php5-common
|
||||
php5-curl
|
||||
php5-dev
|
||||
php5-fpm
|
||||
php5-gd
|
||||
php5-imap
|
||||
php5-intl
|
||||
php5-json
|
||||
php5-mcrypt
|
||||
php5-memcache
|
||||
php5-pspell
|
||||
php5-sqlite
|
||||
php5-xsl
|
||||
postfix
|
||||
postfix-pcre
|
||||
postgrey
|
||||
python3
|
||||
python3-dateutil
|
||||
python3-dev
|
||||
python3-dnspython
|
||||
python3-flask
|
||||
python3-pip
|
||||
pyzor
|
||||
razor
|
||||
resolvconf
|
||||
spampd
|
||||
sqlite3
|
||||
sudo
|
||||
tinymce
|
||||
ufw
|
||||
unattended-upgrades
|
||||
unzip
|
||||
wget
|
||||
30
containers/docker/container_start.sh
Executable file
30
containers/docker/container_start.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script is used within containers to turn it into a Mail-in-a-Box.
|
||||
# It is referenced by the Dockerfile. You should not run it directly.
|
||||
########################################################################
|
||||
|
||||
# Local configuration details were not known at the time the Docker
|
||||
# image was created, so all setup is defered until the container
|
||||
# is started. That's when this script runs.
|
||||
|
||||
# If we're not in an interactive shell, set defaults.
|
||||
if [ ! -t 0 ]; then
|
||||
export PUBLIC_IP=auto
|
||||
export PUBLIC_IPV6=auto
|
||||
export PRIMARY_HOSTNAME=auto
|
||||
export CSR_COUNTRY=US
|
||||
export NONINTERACTIVE=1
|
||||
fi
|
||||
|
||||
# Start configuration.
|
||||
cd /usr/local/mailinabox
|
||||
export IS_DOCKER=1
|
||||
export DISABLE_FIREWALL=1
|
||||
source setup/start.sh # using 'source' means an exit from inside also exits this script and terminates container
|
||||
|
||||
# Once the configuration is complete, start the Unix init process
|
||||
# provided by the base image. We're running as process 0, and
|
||||
# /sbin/my_init needs to run as process 0, so use 'exec' to replace
|
||||
# this shell process and not fork a new one. Nifty right?
|
||||
exec /sbin/my_init -- bash
|
||||
50
containers/docker/run.sh
Executable file
50
containers/docker/run.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
# Use this script to launch Mail-in-a-Box within a docker container.
|
||||
# ==================================================================
|
||||
#
|
||||
# A base image is created first. The base image installs Ubuntu
|
||||
# packages and pulls in the Mail-in-a-Box source code. This is
|
||||
# defined in Dockerfile at the root of this repository.
|
||||
#
|
||||
# A mailinabox-userdata container is started next. This container
|
||||
# contains nothing but a shared volume for storing user data.
|
||||
# It is segregated from the rest of the live system to make backups
|
||||
# easier.
|
||||
#
|
||||
# The mailinabox-services container is started last. It is the
|
||||
# real thing: it runs the mailinabox image. This container will
|
||||
# initialize itself and will initialize the mailinabox-userdata
|
||||
# volume if the volume is new.
|
||||
|
||||
|
||||
DOCKER=docker.io
|
||||
|
||||
# Build or rebuild the image.
|
||||
# Rebuilds are very fast.
|
||||
$DOCKER build -q -t mailinabox .
|
||||
|
||||
# Start the user-data containerw which is merely to create
|
||||
# a container that maintains a reference to a volume so that
|
||||
# we can destroy the main container without losing user data.
|
||||
if ! $DOCKER ps -a | grep mailinabox-userdata > /dev/null; then
|
||||
echo Starting user-data volume container...
|
||||
$DOCKER run -d \
|
||||
--name mailinabox-userdata \
|
||||
-v /home/user-data \
|
||||
scratch bash
|
||||
fi
|
||||
|
||||
# End a running container.
|
||||
if $DOCKER ps -a | grep mailinabox-services > /dev/null; then
|
||||
echo Deleting container...
|
||||
$DOCKER rm mailinabox-services
|
||||
fi
|
||||
|
||||
# Start container.
|
||||
echo Starting new container...
|
||||
$DOCKER run \
|
||||
-p 25 -p 53 -p 80 -p 443 -p 587 -p 993 \
|
||||
--volumes-from mailinabox-userdata \
|
||||
--name mailinabox-services \
|
||||
-t -i \
|
||||
mailinabox
|
||||
Reference in New Issue
Block a user