Skip to content

Instantly share code, notes, and snippets.

@LinkPhoenix
Last active October 20, 2025 00:33
Show Gist options
  • Select an option

  • Save LinkPhoenix/6cadab5d059bae607b730b277683bbf0 to your computer and use it in GitHub Desktop.

Select an option

Save LinkPhoenix/6cadab5d059bae607b730b277683bbf0 to your computer and use it in GitHub Desktop.
Docker Compose stack for Roundcube webmail with MySQL, Traefik proxy, Cloudflare TLS, and extensive plugins, configured for mail server on same host. Stalwart Tested.
# Roundcube Docker Compose Stack with Traefik and Cloudflare
#
# Description:
# Deploys Roundcube webmail (version 1.6.11-apache) along with a MySQL 8.0 database,
# configured for Traefik reverse proxy using Cloudflare certresolver.
# Includes a wide array of relevant plugins enabled for advanced mail features.
# The domain is masked as domain.ltd for privacy; update your real domain accordingly.
# Added extra_hosts for mail.domain.ltd assuming the mail server is on the same host as Roundcube.
#
# Environment:
# Tested on Traefik + Cloudflare + Stalwart mail server environment.
#
# Usage:
# - Define environment variables in .env file for domain, DB, paths, etc.
# - Ensure traefik-net external network exists.
# - Deploy with `docker-compose up -d`.
#
# Author: LinkPhoenix
# Created: 2025-10-20
# Version: 1.0
#
services:
roundcube:
image: roundcube/roundcubemail:1.6.11-apache
container_name: ${ROUNDCUBE_APP_NAME}
restart: unless-stopped
depends_on:
- ${ROUNDCUBE_APP_NAME}_db
extra_hosts:
- "mail.domain.ltd:1.2.3.4" # Replace with your mail server IP if same host
networks:
traefik-net:
ipv4_address: 172.28.0.21 # Fix IP in Traefik's Network
default: {}
environment:
# IMAP – SSL direct (port 993)
- ROUNDCUBEMAIL_DEFAULT_HOST=ssl://mail.domain.ltd
- ROUNDCUBEMAIL_DEFAULT_PORT=993
- ROUNDCUBEMAIL_SMTP_SERVER=ssl://mail.domain.ltd
- ROUNDCUBEMAIL_SMTP_PORT=465
# Plugins and skin
- ROUNDCUBEMAIL_PLUGINS=managesieve,markasjunk,zipdownload,emoticons,identity_select,newmail_notifier,password,archive,enigma,help,show_additional_headers,subscriptions_option,userinfo,thunderbird_labels,tls_icon,banner_warn,swipe,contextmenu,quota,account_details,custom_from,contextmenu_folder
- ROUNDCUBEMAIL_COMPOSER_PLUGINS=weird-birds/thunderbird_labels,germancoding/tls_icon,radialapps/banner-warn,johndoh/swipe,johndoh/contextmenu,texxasrulez/quota,texxasrulez/account_details,r3c/custom-from,random-cuber/contextmenu_folder
- ROUNDCUBEMAIL_SKIN=elastic
- ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE=${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}
- ROUNDCUBEMAIL_DES_KEY=${DES_KEY}
- ROUNDCUBEMAIL_INSTALL_PLUGINS=true
# Database config
- ROUNDCUBEMAIL_DB_TYPE=${DB_TYPE}
- ROUNDCUBEMAIL_DB_HOST=roundcube_db
- ROUNDCUBEMAIL_DB_USER=${DB_USER}
- ROUNDCUBEMAIL_DB_PASSWORD=${DB_PASSWORD}
- ROUNDCUBEMAIL_DB_NAME=${DB_NAME}
volumes:
- ${ROUNCUBE_PATH}/html:/var/www/html
- ${ROUNCUBE_PATH}/html/temp:/var/www/html/temp
- ${ROUNCUBE_PATH}/html/logs:/var/www/html/logs
labels:
- "traefik.enable=true"
- "traefik.http.routers.roundcube.rule=Host(`${ROUNDCUBE_DOMAIN}`)"
- "traefik.http.routers.roundcube.entrypoints=websecure"
- "traefik.http.routers.roundcube.tls.certresolver=cloudflare"
- "traefik.http.services.roundcube.loadbalancer.server.port=80"
roundcube_db:
image: mysql:8.0
container_name: ${ROUNDCUBE_APP_NAME}_db
restart: unless-stopped
networks:
- default
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- ${ROUNCUBE_PATH}/data:/var/lib/mysql
networks:
traefik-net:
external: true
default:
driver: bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment