diff --git a/3.0/Dockerfile b/3.0/Dockerfile deleted file mode 100644 index 1e3ba50..0000000 --- a/3.0/Dockerfile +++ /dev/null @@ -1,154 +0,0 @@ -# -# This image uses 2 interstage and an php:7.1-apache final stage -# -# Interstages are: -# - composer -# - npm & yarn & grunt -# -# Final stage gets all that generated stuff and add it to the final image -# - -############################ -#=== composer interstage === -############################ -FROM composer:latest as composer -WORKDIR /app - -#=== Get PMF source code === -ARG PMF_BRANCH="2.9" -RUN set -x \ - && git clone \ - --depth 1 \ - -b $PMF_BRANCH \ - https://github.com/thorsten/phpMyFAQ.git \ - /app - -#=== Call composer === -RUN set -x \ - && composer install --no-dev - -######################## -#=== yarn interstage === -######################## -FROM node:latest as yarn -WORKDIR /app - -#=== Get PMF source code from previous stage === -COPY --from=composer /app /app - -#=== Install dependencies === -RUN set -x \ - && npm install node-sass -g --unsafe-perm - -#=== Build assets === -RUN set -x \ - && yarn install \ - && yarn build - -################################# -#=== Final stage with payload === -################################# -FROM php:7.1-apache - -#=== Install gd php dependencie === -RUN set -x \ - && buildDeps="libpng-dev libjpeg-dev libfreetype6-dev" \ - && apt-get update && apt-get install -y ${buildDeps} --no-install-recommends \ - \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ - && docker-php-ext-install gd \ - \ - && apt-get purge -y ${buildDeps} \ - && rm -rf /var/lib/apt/lists/* - -#=== Install ldap php dependencie === -RUN set -x \ - && buildDeps="libldap2-dev" \ - && apt-get update && apt-get install -y ${buildDeps} --no-install-recommends \ - \ - && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ - && docker-php-ext-install ldap \ - \ - && apt-get purge -y ${buildDeps} \ - && rm -rf /var/lib/apt/lists/* - -#=== Install intl, soap opcache, and zip php dependencie === -RUN set -x \ - && buildDeps="libicu-dev zlib1g-dev libxml2-dev" \ - && apt-get update && apt-get install -y ${buildDeps} --no-install-recommends \ - \ - && docker-php-ext-configure intl \ - && docker-php-ext-install intl \ - && docker-php-ext-install zip \ - && docker-php-ext-install soap \ - && docker-php-ext-install opcache \ - \ - && apt-get purge -y ${buildDeps} \ - && rm -rf /var/lib/apt/lists/* - -#=== Install mysqli php dependencie === -RUN set -x \ - && docker-php-ext-install mysqli - -#=== Install pgsql dependencie === -RUN set -ex \ - && buildDeps="libpq-dev" \ - && apt-get update && apt-get install -y $buildDeps \ - \ - && docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \ - && docker-php-ext-install pdo pdo_pgsql pgsql \ - \ - && apt-get purge -y ${buildDeps} \ - && rm -rf /var/lib/apt/lists/* - -#=== Apache vhost === -RUN { \ - echo ''; \ - echo 'DocumentRoot /var/www/html'; \ - echo; \ - echo ''; \ - echo '\tOptions -Indexes'; \ - echo '\tAllowOverride all'; \ - echo ''; \ - echo ''; \ - } | tee "$APACHE_CONFDIR/sites-available/app.conf" \ - && set -x \ - && a2ensite app \ - && a2dissite 000-default \ - && echo "ServerName localhost" >> $APACHE_CONFDIR/apache2.conf - -#=== Apache security === -RUN { \ - echo 'ServerTokens Prod'; \ - echo 'ServerSignature Off'; \ - echo 'TraceEnable Off'; \ - echo 'Header set X-Content-Type-Options: "nosniff"'; \ - echo 'Header set X-Frame-Options: "sameorigin"'; \ - } | tee $APACHE_CONFDIR/conf-available/security.conf \ - && set -x \ - && a2enconf security - -#=== php default === -ENV PMF_TIMEZONE="Europe/Berlin" \ - PMF_ENABLE_UPLOADS=On \ - PMF_MEMORY_LIMIT=64M \ - PMF_DISABLE_HTACCESS="" \ - PHP_LOG_ERRORS=On \ - PHP_ERROR_REPORTING=E_ALL - -#=== Add source code from previously built interstage === -COPY --from=yarn /app/phpmyfaq . - -#=== Ensure debug mode is disabled and do some other stuff over the code === -RUN set -x \ - && sed -ri ./src/Bootstrap.php \ - -e "s~define\('DEBUG', true\);~define\('DEBUG', false\);~" \ - && mv ./config ../saved-config - -#=== Set custom entrypoint === -COPY docker-entrypoint.sh /entrypoint -RUN chmod +x /entrypoint -ENTRYPOINT [ "/entrypoint" ] - -#=== Re-Set CMD as we changed the default entrypoint === -CMD [ "apache2-foreground" ] diff --git a/3.0/docker-entrypoint.sh b/3.0/docker-entrypoint.sh deleted file mode 100644 index 3d98313..0000000 --- a/3.0/docker-entrypoint.sh +++ /dev/null @@ -1,105 +0,0 @@ -#! /bin/sh - -# Exit on error -set -e - -#=== Set folder permissions === -folders="attachments data images config" - -mkdir -vp $folders - -{ - if [ -f "$APACHE_ENVVARS" ]; then - . "$APACHE_ENVVARS" - chown -R "$APACHE_RUN_USER:$APACHE_RUN_GROUP" $folders - else - chown -R www-data:www-data $folders - fi - chmod 775 $folders -} - -#=== Check config files === -if [ ! -e "./config" ]; then - echo >&2 'WARN: missing config folder' - echo >&2 ' Did you forget to -v some_config_folder:/var/www/html/config ?' -else - for _file in ../saved-config/*.php; do - [ ! -e ./config/$( basename $_file ) ] && cp -v $_file ./config/$( basename $_file ) - done -fi - -##=== Check database vars === -#=== DB host === -if [ -z "$PMF_DB_HOST" -a ! -e "./config/database.php" ]; then - echo >&2 'WARN: missing PMF_DB_HOST environment variable' - echo >&2 ' Did you forget to --link some_mysql_container:db ?' -else - #=== DB user and pass === - : ${PMF_DB_USER:=root} - if [ "$PMF_DB_USER" = 'root' ]; then - : ${PMF_DB_PASS:=$DB_ENV_MYSQL_ROOT_PASSWORD} - fi - - if [ -z "$PMF_DB_PASS" ]; then - echo >&2 'ERROR: missing required PMF_DB_PASS environment variable' - echo >&2 ' Did you forget to -e PMF_DB_PASS=... ?' - echo >&2 - echo >&2 ' (Also of interest might be PMF_DB_USER and PMF_DB_NAME.)' - exit 1 - #=== Setup database if needed === - elif [ 0 -eq 1 ]; then # TODO : Add something like: php setup/maintenance.php --vars... - { - echo "&2 'WARN: missing config folder' - echo >&2 ' Did you forget to -v some_config_folder:/var/www/html/config ?' -else - for _file in ../saved-config/*.php; do - [ ! -e ./config/$( basename $_file ) ] && cp -v $_file ./config/$( basename $_file ) - done -fi +for _file in ../saved-config/*.php; do + [ ! -e ./config/$( basename $_file ) ] && cp -v $_file ./config/$( basename $_file ) +done if [ -f "$APACHE_ENVVARS" ]; then #=== Enable htaccess for search engine optimisations === @@ -56,6 +51,8 @@ fi echo "date.timezone = $PMF_TIMEZONE" echo "memory_limit = $PMF_MEMORY_LIMIT" echo "file_upload = $PMF_ENABLE_UPLOADS" + echo "post_max_size = $PHP_POST_MAX_SIZE" + echo "upload_max_filesize = $PHP_UPLOAD_MAX_FILESIZE" } | tee $PHP_INI_DIR/conf.d/php.ini #=== Set recommanded opcache settings ===