ghcr.io/docker-mailserver/docker-mailserver:latest (debian) CI/CD Development ImageThis image is maintained solely for use by myself in CI/CD pipelines. It's purpose is to pre-package environment variables and install tools i need to reduce runtime and Lines of Code.
Because they are inherently large in size, its recommended to use a dependency proxy:
- echo "$CI_DEPENDENCY_PROXY_PASSWORD" | docker login $CI_DEPENDENCY_PROXY_SERVER -u $CI_DEPENDENCY_PROXY_USER --password-stdin || echo "Failed to login to dependency proxy, continuing..."
Uses Multi-Stage Build to copy binaries and files from the following official images:
Sets Environment variables for GitLab Runner's Docker-in-Docker (tcp://docker:2376)
Installs Common Unix utilities from apt, including: curl, wget, git, openssl, wait-for-it, dos2unix, bc, netcat-openbsd, ripgrep, gettext, and build tools (build-essential, gcc, pkg-config, binutils). Upgrades all system packages for increased security. Does not clear update cache.
Installs Taskfile (task) - Simpler Make alternative to /usr/bin
Installs swaks - Swiss Army Knife for SMTP to /usr/bin
Installs Ruby, gem, and bundler - because some Asciidoctor Tools require it.
Installs nvm - because my project's arent node based, but some things require node, so CI does not have to fall back to starting node container just for one off thing
Mail Server Configuration:
[email protected]/etc/dovecot/conf.d/99-jonaspammer.conf)Docker HEALTHCHECK: SMTP port listening check with 3-second timeout
ARG BASE_IMAGE="ghcr.io/docker-mailserver/docker-mailserver:latest"
FROM ${BASE_IMAGE}
FROM selenium/standalone-chrome AS chrome
FROM docker:27-cli AS docker-cli
FROM ${BASE_IMAGE:-ubuntu:latest}
## Common Features
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
# Enable e.g. 'source' and [[
SHELL ["/bin/bash", "-c"]
# Set up environment variables for Docker-in-Docker communication as per GitLab Runner
ENV DOCKER_HOST=tcp://docker:2376 \
DOCKER_TLS_CERTDIR=/certs \
DOCKER_TLS_VERIFY=1 \
DOCKER_CERT_PATH=/certs/client
# Add docker binary and optional supporting files from the docker-cli image
COPY --from=docker-cli /usr/local/bin/docker /usr/local/bin/docker
COPY --from=docker-cli /usr/local/libexec/docker /usr/local/libexec/docker
# Add Chrome support
COPY --from=chrome /opt/selenium /opt/selenium
COPY --from=chrome /usr/bin/google-chrome /usr/bin/google-chrome
COPY --from=chrome /usr/bin/google-chrome /usr/bin/chromedriver
# choose fastest mirror (https://www.baeldung.com/linux/apt-terminal-choose-fastest-mirror)
RUN source /etc/os-release && \
if [[ "$ID" == "ubuntu" ]]; then \
sed -iv "s|deb [a-z]*://[^ ]* |deb mirror://mirrors.ubuntu.com/mirrors.txt |g" /etc/apt/sources.list; \
fi;
# (Deliberately not removing apt cache)
RUN apt-get -qy update && apt-get -qy upgrade && apt-get -qy autoremove
RUN apt-get -qy install tzdata
# Install common Unix utilities
RUN apt-get -qy install curl tar zip unzip wget sed recode dos2unix rpl grep coreutils rsync git jq build-essential util-linux net-tools tree dnsutils iputils-ping
# Install useful CI tools
RUN apt-get -qy install openssl bc netcat-openbsd wait-for-it ripgrep gettext gcc pkg-config binutils
RUN apt-get -qqy install bat nano iproute2 || true
# Install "SMTP Swiss Army Knife"
RUN (curl -L https://jetmore.org/john/code/swaks/files/swaks-20240103.0/swaks -o /usr/bin/swaks && chmod 755 /usr/bin/swaks) || apt-get install -qy swaks
# Install Taskfile
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/bin
# Install Ruby, gem, and Bundler
RUN apt-get -qy install ruby && gem install bundler
# https://github.com/ruby/bigdecimal/issues/297 - fix bigdecimal install error
RUN apt-get -qy install libjemalloc-dev libgmp-dev libz-dev clang
# Install Node Version Manager
ENV NVM_DIR=/root/.nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
ARG POSTMASTER_ADDRESS="[email protected]"
# https://github.com/docker-mailserver/docker-mailserver/blob/master/mailserver.env
## General section
ENV POSTMASTER_ADDRESS=${POSTMASTER_ADDRESS}
ENV ENABLE_UPDATE_CHECK=0
ENV PERMIT_DOCKER=connected-networks
#ENV SPOOF_PROTECTION=0
ENV ENABLE_OPENDKIM=0
ENV ENABLE_OPENDMARC=0
ENV ENABLE_POLICYD_SPF=0
#ENV ENABLE_POP3=0
#ENV ENABLE_IMAP=1
#ENV ENABLE_CLAMAV=0
#ENV ENABLE_RSPAMD=0
#ENV ENABLE_FAIL2BAN=0
ENV ENABLE_AMAVIS=0
ENV ENABLE_QUOTAS=0
#ENV POSTFIX_MESSAGE_SIZE_LIMIT=10240000
ENV POSTFIX_INET_PROTOCOLS=ipv4
ENV DOVECOT_INET_PROTOCOLS=ipv4
## SpamAssasin section
#ENV ENABLE_SPAMASSASSIN=0
ENV MOVE_SPAM_TO_JUNK=0
# https://docker-mailserver.github.io/docker-mailserver/latest/config/account-management/provisioner/file/
RUN setup email add "${POSTMASTER_ADDRESS}" admin
# https://docker-mailserver.github.io/docker-mailserver/latest/faq/#can-i-use-a-nakedbare-domain-ie-no-hostname
RUN echo "mydestination = localhost.$mydomain, localhost" > /tmp/docker-mailserver/postfix-main.cf
COPY mailserver-dovecot.cf /etc/dovecot/conf.d/99-jonaspammer.conf
# https://github.com/docker-mailserver/docker-mailserver/blob/master/compose.yaml
HEALTHCHECK --timeout=3s CMD ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1
Content type
Image
Digest
sha256:8b88adb32…
Size
904.1 MB
Last updated
8 months ago
docker pull jonaspammerwork/mailserver