From dec1fac749ab3b8d9f9d780c196bc2ed5c49373f Mon Sep 17 00:00:00 2001 From: Brad Date: Sun, 25 Aug 2024 14:43:14 -0700 Subject: [PATCH 1/2] Docker Development Environment --- Dockerfile | 56 +++++++++++++++++++++++++++++++++++++++++ README.md | 18 +++++++++++++ docker-compose.yml | 33 ++++++++++++++++++++++++ entrypoint.sh | 11 ++++++++ skins/elastic/README.md | 2 +- 5 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..8d851bffdd0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,56 @@ +# Use the official PHP image as the base +FROM php:8.1-apache + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + git \ + unzip \ + libpng-dev \ + libjpeg-dev \ + libfreetype6-dev \ + libonig-dev \ + libxml2-dev \ + libldap2-dev \ + libzip-dev \ + libmagickwand-dev \ + libpq-dev \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu \ + && docker-php-ext-install pdo pdo_pgsql pgsql mbstring exif pcntl bcmath gd zip intl ldap + +# Install Imagick +RUN pecl install imagick && docker-php-ext-enable imagick + +# Install Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Install Node.js and npm (latest stable version) +RUN curl -sL https://deb.nodesource.com/setup_current.x | bash - \ + && apt-get install -y nodejs + +# Set the working directory +WORKDIR /var/www/html + +# Debug: List files in the working directory +RUN ls -la /var/www/html + +# Copy the entrypoint script +COPY entrypoint.sh /usr/local/bin/ + +# Ensure the entrypoint script is executable +RUN chmod +x /usr/local/bin/entrypoint.sh + +# Copy the rest of the application code +COPY . . + +# Set the timezone in php.ini +RUN echo "date.timezone = UTC" > /usr/local/etc/php/conf.d/timezone.ini + +# Expose the port the app runs on +EXPOSE 80 + +# Set the entrypoint +ENTRYPOINT ["entrypoint.sh"] + +# Start Apache server +CMD ["apache2-foreground"] diff --git a/README.md b/README.md index ba54888354f..6a5a1aa508d 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,24 @@ inherits the browser support from there. This currently includes: - Safari: (Current - 1) and Current - Opera: Current +DEVELOPMENT SETUP +----------------- +- Clone the repository from Github +- Run 'docker-compose up' to start the development environment +- Run http://localhost:8080/installer + - Follow the instructions to install Roundcube + - DB Setup + - Database type: postgreSQL + - Database server: roundcube-db + - Database name: roundcubemail + - Database user: roundcube + - Database password: password + - IMAP Setup + - IMAP host: mailserver:143 +- Create a test email account + - Bash into the roundcubeMailServer + - Run 'setup email add test@test.com password' + LICENSE ------- diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000000..e4f2377ceea --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +version: '3.8' + +services: + roundcube: + build: . + ports: + - "8080:80" + volumes: + - .:/var/www/html + depends_on: + - roundcube-db + + roundcube-db: + image: postgres:13 + restart: always + environment: + POSTGRES_DB: roundcubemail + POSTGRES_USER: roundcube + POSTGRES_PASSWORD: password + volumes: + - db_roundcubeData:/var/lib/postgresql/data + + mailserver: + image: docker.io/mailserver/docker-mailserver:latest + container_name: roundcubeMailServer + hostname: mail.test.com + restart: always + cap_add: + - NET_ADMIN + - SYS_PTRACE + +volumes: + db_roundcubeData: diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000000..a721aa987b4 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +# Install PHP dependencies +composer install --no-dev --optimize-autoloader + +# Install JavaScript dependencies +npm install --include=dev --omit=optional + +# Execute the CMD from the Dockerfile +exec "$@" diff --git a/skins/elastic/README.md b/skins/elastic/README.md index 40dd0b57afc..baf5d9e9a54 100644 --- a/skins/elastic/README.md +++ b/skins/elastic/README.md @@ -38,7 +38,7 @@ using the `lessc` command line tool (that you can install with `npm install`). References to image files from the included CSS files can be appended with cache-buster marks to avoid browser caching issues after updating. -Run `bin/updatecss.sh --dir skins/elastic` before packaging the skin +Run `php bin/updatecss.sh --dir skins/elastic` before packaging the skin or after installing it on the destination system. From c64a5af50703338eece9d7f3265df80d8f210a1d Mon Sep 17 00:00:00 2001 From: Brad Date: Sun, 25 Aug 2024 15:56:11 -0700 Subject: [PATCH 2/2] README.md updates --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a5a1aa508d..33c71f8e66c 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,13 @@ DEVELOPMENT SETUP - IMAP Setup - IMAP host: mailserver:143 - Create a test email account - - Bash into the roundcubeMailServer + - Run 'docker-compose exec roundcubeMailServer bash' - Run 'setup email add test@test.com password' +- Final Steps + - Run 'docker-compose exec roundcube-webmail bash' + - Run 'php bin/install-jsdeps.sh' + - cd skins/elastic + - Run 'make' LICENSE