Skip to content

Add VS Code DevContainer for simplified development setup #10084

@JohnRDOrazio

Description

@JohnRDOrazio

Summary

Setting up a Roundcube development environment currently requires manually configuring PHP with the correct extensions, a database server (MySQL/MariaDB/PostgreSQL/SQLite), an IMAP server for testing, and various JavaScript build tools. This can be time-consuming and error-prone, especially for new contributors.

Proposal

Add a VS Code DevContainer configuration that provides a complete, reproducible development environment with a single click. The DevContainer would include:

Services

  • PHP 8.4 with all required extensions (gd, intl, ldap, pdo_mysql, pdo_pgsql, pdo_sqlite, zip, opcache) and optional extensions (exif, imagick, enchant, xdebug)
  • MariaDB 11 for database testing
  • Dovecot IMAP server with a test user (testuser/testpass)
  • Mailhog for capturing outgoing emails during testing

Automation

  • Automatic database initialization on first start
  • Composer and npm dependency installation
  • JavaScript library downloads (jQuery, TinyMCE, CodeMirror)
  • CSS compilation from LESS sources
  • Development configuration file generation

VS Code Integration

  • Pre-configured tasks for common operations:
    • Start development server
    • Run PHPUnit tests
    • PHP CS Fixer (check/fix)
    • PHPStan analysis
    • ESLint
    • Database management (init/reset/status)
  • Recommended extensions (Intelephense, PHP Debug, ESLint, etc.)

Benefits

  1. Lower barrier to entry - New contributors can start developing immediately without environment setup
  2. Consistency - All developers work in identical environments, reducing "works on my machine" issues
  3. Cross-platform - Works on Windows (WSL 2), macOS (Intel and Apple Silicon), and Linux
  4. Isolation - Development environment doesn't affect host system
  5. Documentation - The DevContainer configuration serves as executable documentation of requirements

Additional Changes

This enhancement also includes some minor fixes discovered during development:

  • Exclude actual shell scripts from php-cs-fixer (the *.sh pattern was intended for PHP CLI scripts in bin/ that use .sh extension, not bash scripts)
  • Add tests/.phpunit.result.cache to .gitignore

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions