From 9def853d9582e76a4d6e2219d3b092cec386c78e Mon Sep 17 00:00:00 2001 From: Erki Aas Date: Tue, 1 Aug 2023 14:46:12 +0300 Subject: [PATCH] Build custom docker image with forked Freescout enabling s3 --- Dockerfile | 63 ++++++++++++++++++++++++++++++++++++++++++-- config/opcache.ini | 4 +++ config/overrides.ini | 1 + config/uploads.ini | 1 + 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 config/opcache.ini create mode 100644 config/overrides.ini create mode 100644 config/uploads.ini diff --git a/Dockerfile b/Dockerfile index bfed380..ea0f0fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,61 @@ -FROM docker.io/tiredofit/freescout -RUN git clone https://github.com/bolsunovskyi/freescout-oauth.git /assets/modules/OAuth +FROM php:7.4-apache AS php-base + +# Set Apache document root +ENV APACHE_DOCUMENT_ROOT /app/public +RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf +RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf + +# Use the default production configuration +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +# Dependencies +RUN apt-get update -y && apt-get install -y ssh libpng-dev libkrb5-dev libmagickwand-dev libjpeg-dev libmemcached-dev zlib1g-dev libzip-dev git unzip subversion ca-certificates libicu-dev libxml2-dev libmcrypt-dev libc-client-dev && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/ + +# PHP Extensions - PECL +RUN pecl install imagick-3.4.4 memcached mcrypt-1.0.4 && docker-php-ext-enable imagick memcached mcrypt + +# PHP Extensions - configure imap +RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl + +# PHP Extensions - docker-php-ext-install +RUN docker-php-ext-install zip gd mysqli exif pdo pdo_mysql opcache intl imap + +# PHP Extensions - docker-php-ext-configure +RUN docker-php-ext-configure intl + +# PHP Tools +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && php composer-setup.php --install-dir=/usr/local/bin --filename=composer + +# Config +RUN a2enmod rewrite + +# Override default config with custom PHP settings +COPY config/* $PHP_INI_DIR/conf.d/ + +# Rewrite port +RUN sed -ri -e 's/80/8080/g' /etc/apache2/ports.conf +RUN sed -ri -e 's/80/8080/g' /etc/apache2/sites-available/*.conf +RUN sed -ri -e 's/80/8080/g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf + +# Use www-data +RUN mkdir /app +RUN chown www-data:www-data /app + +FROM php-base AS php + +USER www-data +WORKDIR /app + +# Install freescout +RUN git clone -b add-s3-support https://github.com/veebkolm/freescout.git /app + +# Install oauth plugin +RUN git clone https://github.com/bolsunovskyi/freescout-oauth.git /app/Modules/OAuth + +# Install Composer dependencies +RUN cd /app && composer install --no-dev && composer clear-cache + +# Create necessary symlink +RUN php artisan storage:link + +EXPOSE 8080 diff --git a/config/opcache.ini b/config/opcache.ini new file mode 100644 index 0000000..f042196 --- /dev/null +++ b/config/opcache.ini @@ -0,0 +1,4 @@ +opcache.enable=1 +opcache.memory_consumption=64 +opcache.max_accelerated_files=10000 +opcache.revalidate_freq=0 diff --git a/config/overrides.ini b/config/overrides.ini new file mode 100644 index 0000000..e0c4f96 --- /dev/null +++ b/config/overrides.ini @@ -0,0 +1 @@ +max_execution_time=90 diff --git a/config/uploads.ini b/config/uploads.ini new file mode 100644 index 0000000..e0c4f96 --- /dev/null +++ b/config/uploads.ini @@ -0,0 +1 @@ +max_execution_time=90