Sign inSign up

hezzit/roundcube

By hezzit

β€’Updated over 1 year ago

Docker image for Roundcube Webmail. Ready for production, built by Hezzit.

Image
Web servers
0

279

hezzit/roundcube repository overview

Dev Build ⁠ Release Build ⁠ Latest Release ⁠ Docker Image Size ⁠

β πŸ“¬ Hezzit Roundcube Webmail – Docker Edition

Welcome to the Dockerized Roundcube setup from Hezzit β€” fast to deploy, easy to customize, and ready for production. Built for flexibility, it supports two operation modes:

  • πŸ”§ fpm-only: Use it behind your own Nginx reverse proxy.
  • πŸš€ full: Includes Nginx + PHP-FPM in a single container.

πŸ“¦ Image: hezzit/roundcube


β πŸš€ Full Stack Mail Server Deployment Guide⁠

⁠⚑ Quick Launch

You don’t need to build anything. Just pull and run:

β πŸ’š Docker CLI Example
docker pull hezzit/roundcube:latest

docker run \
  -e RUN_MODE=fpm-only \
  -e MAX_UPLOAD_SIZE=100M \
  -e PHP_MEMORY_LIMIT=256M \
  -v "$PWD/roundcube_data/config.inc.php:/var/www/html/config/config.inc.php:ro" \
  -v "$PWD/roundcube_data/plugins:/custom_plugins:ro" \
  -v "$PWD/roundcube_data/skins:/custom_skins:ro" \
  -v "$PWD/roundcube_data/logs:/var/www/html/logs" \
  -v "$PWD/roundcube_data/temp:/var/www/html/temp" \
  -v "$PWD/roundcube_data/php.ini:/usr/local/etc/php/conf.d/zz-custom.ini:ro" \
  -p 9000:9000 \
  hezzit/roundcube:latest
⁠🧱 Docker Compose Example
services:
  roundcube:
    image: hezzit/roundcube:latest
    restart: unless-stopped
    ports:
      # Adjust the exposed port based on the selected RUN_MODE:
      #- "8080:80"   # Use this for RUN_MODE=full (internal Nginx)
      - "9000:9000"   # Use this for RUN_MODE=fpm-only (external Nginx). Adjust to match your external Nginx config.
    environment:
      # --- Mode Selection ---
      RUN_MODE: "fpm-only"         # Set to "full" or "fpm-only"
      # --- Upload and Memory Limits ---
      MAX_UPLOAD_SIZE: "100M"      # Max upload size, e.g., 100M or 1G
      PHP_MEMORY_LIMIT: "256M"     # PHP memory limit, e.g., 256M or 512M
      # --- Timezone (Optional) ---
      #TZ: "Europe/London"        # Examples: "America/Sao_Paulo", "Europe/Paris", "America/New_York"
      # --- Roundcube DES_KEY Checker (Optional) ---
      # Use to activate or deactivate the DES_KEY checker, preventing or not initialization (DEFAULT "false")
      #ROUNDCUBE_SKIP_DES_KEY_CHECK: "true" #OR "false"
      ################################
      # NOTE: Roundcube-specific settings (DB, SMTP, IMAP, DES_KEY, etc.)
      # should be configured directly in the mounted config.inc.php file below.
      ################################
    volumes:
      # --- Main Roundcube Configuration File ---
      - ./roundcube_data/config.inc.php:/var/www/html/config/config.inc.php:ro
      # --- Custom Plugins and Skins ---
      - ./roundcube_data/plugins:/custom_plugins:ro
      - ./roundcube_data/skins:/custom_skins:ro
      # --- Logs and Temp Files (Optional Persistence) ---
      - ./roundcube_data/logs:/var/www/html/logs
      - ./roundcube_data/temp:/var/www/html/temp
      # --- Additional PHP Configuration (Optional) ---
      # Use this file for additional PHP directives.
      # Avoid setting upload_max_filesize, post_max_size, and memory_limit here if using ENV variables above.
      - ./roundcube_data/php.ini:/usr/local/etc/php/conf.d/zz-custom.ini:ro
    healthcheck:
      # Healthcheck ensures proper startup based on the RUN_MODE
      test: ["CMD-SHELL", "MODE=$${RUN_MODE:-full}; if [ \"$$MODE\" = \"fpm-only\" ]; then supervisorctl status php-fpm | grep -q RUNNING; else supervisorctl status php-fpm | grep -q RUNNING && supervisorctl status nginx | grep -q RUNNING; fi"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
β βš™οΈ config.inc.php Example
<?php

/*
 +--------------------------------------------------------------------------------+
 | Local configuration for the Roundcube Webmail installation.                    |
 |                                                                                |
 | This is a sample configuration file only containing the minimum                |
 | setup required for a functional installation. Copy more options                |
 | from defaults.inc.php to this file to override the defaults.                   |
 | https://github.com/roundcube/roundcubemail/blob/master/config/defaults.inc.php |
 +--------------------------------------------------------------------------------+
*/

$config = [];

// ----------------------------------
// SQL DATABASE
// ----------------------------------

// Database connection string (DSN) for read+write operations
// Choose ONE of the options below based on your setup.

// OPTION 1: SQLite (for simple testing, data is stored inside the container volume)
// Ensure the '/var/www/html/SQL' directory is created with write permissions
// for www-data in the Dockerfile (as discussed previously).
$config['db_dsnw'] = 'sqlite:////var/www/html/SQL/sqlite.db?mode=0646';

// OPTION 2: MySQL/MariaDB (running in another Docker container)
// Uncomment the line below and replace placeholders:
// - 'user': The database user created for Roundcube.
// - 'password': The password for that user.
// - 'db_mariadb': The **service name** of your MariaDB/MySQL container in docker-compose.yml.
// - 'roundcubemail': The name of the database created for Roundcube.
// $config['db_dsnw'] = 'mysql://user:password@db_mariadb/roundcubemail';

// OPTION 3: PostgreSQL (running in another Docker container)
// Uncomment the line below and replace placeholders:
// - 'user': The database user created for Roundcube.
// - 'password': The password for that user.
// - 'db_postgres': The **service name** of your PostgreSQL container in docker-compose.yml.
// - 'roundcubemail': The name of the database created for Roundcube.
// $config['db_dsnw'] = 'pgsql://user:password@db_postgres/roundcubemail';

// --- IMAP Configuration ---
// Use 'ssl://' prefix for Implicit TLS (port 993 usually).
// Use 'tls://' prefix for STARTTLS (port 143 usually).
// Using Implicit TLS on port 993 (standard and recommended).
//$config['imap_host'] = 'ssl://imap.yourdomain.com:993'; //(Another example)
//$config['smtp_host'] = 'tls://mail.yourdomain.com:143'; //(Another example)
// Connect to the 'mailserver' service within the Docker network.
$config['imap_host'] = 'ssl://mailserver:993';
// Optional: If mailserver requires full email address for login
// $config['username_domain'] = 'yourdomain.com'; // Replace with your domain

// --- SMTP Configuration ---
// Use 'ssl://' prefix for Implicit TLS (port 465 usually).
// Use 'tls://' prefix for STARTTLS (port 587 usually).
// Using STARTTLS on port 587 (standard submission port).
//$config['smtp_host'] = 'tls://smtp.yourdomain.com:587'; //(Another example)
//$config['smtp_host'] = 'ssl://mail.yourdomain.com:465'; //(Another example)
// Connect to the 'mailserver' service within the Docker network.
$config['smtp_host'] = 'tls://mailserver:587';


// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
$config['smtp_pass'] = '%p';

// provide an URL where a user can get support for this Roundcube installation
// PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
$config['support_url'] = '';

// Name your service. This is displayed on the login screen and in the window title
$config['product_name'] = 'Roundcube Webmail';

// REQUIRED: Secure key for encryption purposes (e.g., session data, passwords).
// MUST be changed to a random 24-byte string for security!
// You can generate one using: openssl rand -base64 24
// WARNING: Changing this key after users have logged in might cause issues.
$config['des_key'] = '!_PLEASE_CHANGE_THIS_24BYTE_KEY_!';

// List of active plugins (in plugins/ directory)
$config['plugins'] = [
    'archive',
    'zipdownload',
];

// skin name: folder from skins/
$config['skin'] = 'elastic';

// Enables display of email address with name instead of a name (and address in title)
$config['message_show_email'] = true;

// compose html formatted messages by default
//  0 - never,
//  1 - always,
//  2 - on reply to HTML message,
//  3 - on forward or reply to HTML message
//  4 - always, except when replying to plain text message
$config['htmleditor'] = 1;

// Message size limit. Note that SMTP server(s) may use a different value.
// This limit is verified when user attaches files to a composed message.
// Size in bytes (possible unit suffix: K, M, G)
// RECOMMENDED TO SET VALUE LESS THAN OR EQUAL TO ENV: MAX_UPLOAD_SIZE
$config['max_message_size'] = '80M';

// Display remote resources (inline images, styles) in HTML messages. Default: 0.
// 0 - Never, always ask
// 1 - Allow from my contacts (all writeable addressbooks + collected senders and recipients)
// 2 - Always allow
// 3 - Allow from trusted senders only
$config['show_images'] = 1;

// When replying:
// -1 - don't cite the original message
// 0  - place cursor below the original message
// 1  - place cursor above original message (top posting)
// 2  - place cursor above original message (top posting), but do not indent the quote
$config['reply_mode'] = 1;

⁠🌟 Highlights

  • 🐳 Minimal Alpine-based image
  • 🧠 Smart auto-mode switching via environment variables
  • πŸ’‘ Easy integration with custom plugins and themes
  • πŸ”„ Configurable limits (upload size, memory, etc.)
  • πŸ“¦ Persistent volumes for configs, logs, and temp
  • βœ… Built-in healthcheck

β βš™οΈ Configuration Cheat Sheet

β πŸ“Œ Environment Variables
NameDefaultDescription
RUN_MODEfullMode of operation: full or fpm-only
MAX_UPLOAD_SIZE100MUpload file size limit
PHP_MEMORY_LIMIT256MPHP memory limit
TZUTCTimezone, e.g., Europe/London
ROUNDCUBE_SKIP_DES_KEY_CHECKfalseSkip DES key check (not recommended)
β πŸ“ Volume Mounts
Host PathContainer PathPurpose
roundcube_data/config.inc.php/var/www/html/config/config.inc.phpMain Roundcube config
roundcube_data/plugins//custom_plugins/Custom plugins directory
roundcube_data/skins//custom_skins/Custom skins directory
roundcube_data/logs//var/www/html/logs/Logs (optional)
roundcube_data/temp//var/www/html/temp/Temp files (optional)
roundcube_data/php.ini/usr/local/etc/php/conf.d/zz-custom.iniAdditional PHP config (optional)

β πŸ” DES Key Validation

The container enforces strong DES key configuration:

  • Must be different from default/sample
  • Must be 24 or 32 characters If your key is invalid or missing, startup will abort. To skip the validation (not recommended), set:
ROUNDCUBE_SKIP_DES_KEY_CHECK=true

β πŸ‘¨β€πŸ’» Local Development

To build locally:

docker build -t hezzit-roundcube:dev .

To run it interactively:

docker run -it hezzit-roundcube:dev

β πŸ™ Acknowledgements

Special thanks to the creators and maintainers of the original Roundcube Webmail⁠, a powerful open-source IMAP client that this project is based on.

Also, appreciation to the open-source communities behind:

Without these tools, this container wouldn’t be possible.


Built with ❀️ by Hezzit⁠. Contributions are welcome!

πŸ“„ License MIT

Tag summary

Content type

Image

Digest

sha256:060172b82…

Size

74 MB

Last updated

over 1 year ago

docker pull hezzit/roundcube