Skip to content
Snippets Groups Projects
Commit fd281db2 authored by ale's avatar ale
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
image: docker:latest
stages:
- build
- release
services:
- docker:dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
RELEASE_TAG: $CI_REGISTRY_IMAGE:latest
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.git.autistici.org
build:
stage: build
script:
- docker build --pull -t $IMAGE_TAG .
- docker push $IMAGE_TAG
release:
stage: release
script:
- docker pull $IMAGE_TAG
- docker tag $IMAGE_TAG $RELEASE_TAG
- docker push $RELEASE_TAG
only:
- master
FROM registry.git.autistici.org/ai3/docker-apache2-base:master
COPY conf /tmp/conf
COPY build.sh /tmp/build.sh
RUN /tmp/build.sh && rm -fr /tmp/build.sh /tmp/conf
ENTRYPOINT ["/usr/local/bin/chaperone"]
docker-mailman
===
Docker container for Mailman 2.
It runs along with an Apache instance.
The /data volume should be mounted externally (with the appropriate
permissions) and it will be used to store lists, archives and all
the other Mailman runtime data.
build.sh 0 → 100755
#!/bin/sh
#
# Install script for Mailman 2 inside a Docker container.
#
# Packages that are only used to build the site. These will be
# removed once we're done.
BUILD_PACKAGES=""
# Packages required to serve the website and run the services, in
# addition to those already installed by the base apache2 image.
PACKAGES="
mailman
"
# Apache modules to enable.
APACHE_MODULES_ENABLE="
cgi
"
export APACHE_MODULES_ENABLE
# Config snippets to enable for Apache.
APACHE_CONFIG_ENABLE=
export APACHE_CONFIG_ENABLE
# Sites to enable.
APACHE_SITES="
mailman
"
export APACHE_SITES
# The default bitnami/minideb image defines an 'install_packages'
# command which is just a convenient helper. Define our own in
# case we are using some other Debian image.
if [ "x$(which install_packages)" = "x" ]; then
install_packages() {
env DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends "$@"
}
fi
set -e
install_packages ${BUILD_PACKAGES} ${PACKAGES}
# Install the configuration, overlayed over /etc.
rsync -a /tmp/conf/ /etc/
# Setup Apache.
/usr/local/bin/setup-apache.sh
# Create writable storage mountpoint. The situation with /var/lib/mailman
# is complex, there are "data" files and mailman files, and Debian links
# various subdirectories to locations in the /usr filesystem.
#
# Instead, we're going to do the reverse, and replace the "data" subdirs
# in /var/lib/mailman with symbolic links to /data, which will be where
# the data volume will be mounted in the container.
mkdir -p /data
# Exclude 'messages': it is maintained by the Debian package.
mailman_data_subdirs="archives data lists locks logs qfiles spam"
for d in $mailman_data_subdirs ; do
rm -fr /var/lib/mailman/$d || true
ln -sf /data/$d /var/lib/mailman/$d
done
# Create directory for PID file.
mkdir /var/run/mailman
chmod 1777 /var/run/mailman
# Remove packages used for installation.
apt-get remove -y --purge ${BUILD_PACKAGES}
apt-get autoremove -y
apt-get clean
rm -fr /var/lib/apt/lists/*
rm -fr /tmp/conf
<VirtualHost *:${APACHE_PORT}>
ServerName ${SHARD_ID}.mailman.${DOMAIN}
DocumentRoot /var/empty
SetEnvIf X-Forwarded-Proto https HTTPS=on
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" http_host_combined
CustomLog "|/usr/bin/logger -t apache -p local3.info" http_host_combined
LogLevel info
ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/
Alias /pipermail/ /var/lib/mailman/archives/public/
Alias /images/mailman/ /usr/share/images/mailman/
<Directory /usr/lib/cgi-bin/mailman/>
AllowOverride None
Options ExecCGI
AddHandler cgi-script .cgi
Require all granted
</Directory>
<Directory /var/lib/mailman/archives/public/>
Options FollowSymlinks
AllowOverride None
Require all granted
</Directory>
<Directory /usr/share/images/mailman/>
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
mailman.service: {
type: forking,
command: "/usr/lib/mailman/bin/mailmanctl -s -q start",
pidfile: "/var/run/mailman/mailman.pid",
exit_kills: true,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment