diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 60b4c71..9d00b49 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -16,7 +16,7 @@ jobs: DOCKER_TAG_NAME: ${{ github.head_ref || github.ref_name }} strategy: matrix: - php: [7.2, 7.3, 7.4] + php: [7.2, 7.3, 7.4, 8.1] kind: [fpm-alpine, cli-alpine] include: # Note that this is not parallelizable, there are dependencies diff --git a/compose/php/8.1/8.1-dolphin.yml b/compose/php/8.1/8.1-dolphin.yml new file mode 100644 index 0000000..8562326 --- /dev/null +++ b/compose/php/8.1/8.1-dolphin.yml @@ -0,0 +1,9 @@ +version: "3" + +services: + magento2: + image: graycore/magento-php:8.1-fpm-alpine-dolphin-v6.0.0-alpha.2 + environment: + XDEBUG_CLIENT_PORT: "9003" + XDEBUG_CLIENT_HOST: "localhost" + XDEBUG_MODE: "debug" \ No newline at end of file diff --git a/compose/php/8.1/8.1-xdebug.yml b/compose/php/8.1/8.1-xdebug.yml new file mode 100644 index 0000000..c636f34 --- /dev/null +++ b/compose/php/8.1/8.1-xdebug.yml @@ -0,0 +1,8 @@ +version: "3" + +services: + magento2: + image: graycore/magento-php:8.1-fpm-alpine-develop-xdebug + environment: + XDEBUG_CLIENT_PORT: "9003" + XDEBUG_CLIENT_HOST: "host.docker.internal" \ No newline at end of file diff --git a/compose/php/8.1/8.1.yml b/compose/php/8.1/8.1.yml new file mode 100644 index 0000000..991c078 --- /dev/null +++ b/compose/php/8.1/8.1.yml @@ -0,0 +1,5 @@ +version : '3' + +services: + magento2: + image: graycore/magento-php:8.1-fpm-alpine-develop diff --git a/compose/php/8.1/build.yml b/compose/php/8.1/build.yml new file mode 100644 index 0000000..62528bb --- /dev/null +++ b/compose/php/8.1/build.yml @@ -0,0 +1,6 @@ +version : '3' + +services: + magento2: + build: php/8.1/fpm-alpine-dolphin + image: graycore/magento-php:build diff --git a/php/8.1/cli-alpine/Dockerfile b/php/8.1/cli-alpine/Dockerfile new file mode 100644 index 0000000..6ed629f --- /dev/null +++ b/php/8.1/cli-alpine/Dockerfile @@ -0,0 +1,41 @@ +FROM php:8.1-cli-alpine + +LABEL maintainer="damien@graycore.io" + +RUN apk add --no-cache \ + gzip \ + freetype-dev \ + icu-dev \ + libjpeg-turbo-dev \ + libpng-dev \ + libxslt-dev \ + lsof \ + curl-dev \ + libzip-dev \ + libsodium-dev \ + mysql-client \ + procps + +# https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html#required-php-extensions +# This layer must be run as one, not two - See: https://github.com/docker-library/php/issues/855 +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \ + && docker-php-ext-install \ + bcmath \ + gd \ + intl \ + opcache \ + pdo_mysql \ + soap \ + xsl \ + zip \ + sockets + +RUN curl -sS https://getcomposer.org/installer | \ + php -- --install-dir=/usr/local/bin --filename=composer && \ + composer self-update + +COPY conf/php.ini /usr/local/etc/php/ + +RUN chmod 775 /var/www/html && chown root:root /var/www/html + +WORKDIR /var/www/html \ No newline at end of file diff --git a/php/8.1/cli-alpine/conf/php.ini b/php/8.1/cli-alpine/conf/php.ini new file mode 100644 index 0000000..db31a66 --- /dev/null +++ b/php/8.1/cli-alpine/conf/php.ini @@ -0,0 +1,84 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Stock PHP Settings +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user. +; Value "stderr" sends the errors to stderr instead of stdout. +display_errors = Off + +; The display of errors which occur during PHP's startup sequence are handled +; separately from display_errors. +display_startup_errors = Off + +; Besides displaying errors, PHP can also log errors to locations such as a +; server-specific log, STDERR, or a location specified by the error_log +; directive found below. +log_errors = On + +; This directive informs PHP of which errors, warnings and notices you would like +; it to take action for. +error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT + +; This sets the maximum amount of memory in bytes that a script is allowed to allocate. +; This helps prevent poorly written scripts for eating up all available memory on a server. +; Note that to have no memory limit, set this directive to -1. +memory_limit = 4G + +; This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. +; This helps prevent poorly written scripts from tying up the server. +; The default setting is 30. When running PHP from the command line the default setting is 0. +max_execution_time = 30 + +; Maximum amount of time each script may spend parsing request data. It's a good +; idea to limit this time on productions servers in order to eliminate unexpectedly +; long running scripts. +max_input_time = 30 + +; The maximum size of an uploaded file. When an integer is used, the value is measured in bytes. +; Shorthand notation may also be used. +upload_max_filesize = 20M + +; Sets max size of post data allowed. This setting also affects file upload. To upload large files, +; this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be +; larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation may also be used. +post_max_size = 20M + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; OPcache Settings +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; Determines if Zend OPCache is enabled +opcache.enable = 1 + +; The maximum number of keys (and therefore scripts) in the OPcache hash table. +; The actual value used will be the first number in the set of prime numbers { 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 } +; that is greater than or equal to the configured value. The minimum value is 200. +; The maximum value is 1000000. Values outside of this range are clamped to the permissible range. +; +; After running some tests on Magento 2 instances, the typical file count is around 30000. We use double, just in case. +opcache.max_accelerated_files = 65407 + +; When enabled, the opcode cache will be checked for whether a file has already been cached when file_exists(), is_file() and is_readable() are called. +; This may increase performance in applications that check the existence and readability of PHP scripts, but risks returning stale data if opcache.validate_timestamps is disabled. +opcache.enable_file_override = 1 + +;The amount of memory used to store interned strings, in megabytes. +opcache.interned_strings_buffer = 32 + +; The size of the shared memory storage used by OPcache, in megabytes. The minimum permissible value is "8", which is enforced if a smaller value is set. +opcache.memory_consumption = 200 + +; How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request. +; This configuration directive is ignored if opcache.validate_timestamps is disabled. + +; If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds. When this directive is disabled, you must reset OPcache manually via opcache_reset(), +; opcache_invalidate() or by restarting the Web server for changes to the filesystem to take effect. +; +; Since we're using a dockerized environment, we're assuming that the final environment is immutable, and therefore validating timestamps +; is unnecessary. +opcache.validate_timestamps = 0 + +; If disabled, all documentation comments will be discarded from the opcode cache to reduce the size of the optimised code. +; Disabling this configuration directive may break applications and frameworks that rely on comment parsing for annotations, +; including Doctrine, Zend Framework 2, PHPUnit, and Magento 2. +opcache.save_comments = 1 \ No newline at end of file diff --git a/php/8.1/fpm-alpine-develop-xdebug/Dockerfile b/php/8.1/fpm-alpine-develop-xdebug/Dockerfile new file mode 100644 index 0000000..e49af17 --- /dev/null +++ b/php/8.1/fpm-alpine-develop-xdebug/Dockerfile @@ -0,0 +1,14 @@ +FROM graycore/magento-php:8.1-fpm-alpine-develop + +LABEL maintainer="damien@graycore.io" + +USER root:root + +RUN apk --no-cache add pcre-dev ${PHPIZE_DEPS} \ + && pecl install xdebug \ + && docker-php-ext-enable xdebug \ + && apk del pcre-dev ${PHPIZE_DEPS} + +COPY conf/php.ini /usr/local/etc/php/ + +USER app:app diff --git a/php/8.1/fpm-alpine-develop-xdebug/conf/php.ini b/php/8.1/fpm-alpine-develop-xdebug/conf/php.ini new file mode 100644 index 0000000..b987780 --- /dev/null +++ b/php/8.1/fpm-alpine-develop-xdebug/conf/php.ini @@ -0,0 +1,53 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Stock PHP Settings +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; This sets the maximum amount of memory in bytes that a script is allowed to allocate. +; This helps prevent poorly written scripts for eating up all available memory on a server. +; Note that to have no memory limit, set this directive to -1. +memory_limit = 4G + +; This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. +; This helps prevent poorly written scripts from tying up the server. +; The default setting is 30. When running PHP from the command line the default setting is 0. +max_execution_time = 30 + +date.timezone = UTC + +; The maximum size of an uploaded file. When an integer is used, the value is measured in bytes. +; Shorthand notation may also be used. +upload_max_filesize = 20M + +; Sets max size of post data allowed. This setting also affects file upload. To upload large files, +; this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be +; larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation may also be used. +post_max_size = 20M + +; Whether to transparently compress pages. If this option is set to "On" in php.ini or the Apache configuration, +; pages are compressed if the browser sends an "Accept-Encoding: gzip" or "deflate" header. +; "Content-Encoding: gzip" (respectively "deflate") and "Vary: Accept-Encoding" headers are added to the output. +zlib.output_compression = On + +display_errors = stderr +error_log = /dev/stderr +display_startup_errors = On +log_errors = On + +; Where the sendmail program can be found, usually /usr/sbin/sendmail or /usr/lib/sendmail. +; configure does an honest attempt of locating this one for you and set a default, +; but if it fails, you can set it here. +sendmail_path = ${PHP_SENDMAIL_PATH} + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Xdebug Settings +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Selects the host where the debug client is running, you can either use a host name, IP address, or 'unix:///path/to/sock' +; for a Unix domain socket. This setting is ignored if xdebug.remote_connect_back is enabled. +xdebug.client_host = ${XDEBUG_CLIENT_HOST} + +; The port to which Xdebug tries to connect on the remote host. Port 9003 is the default for both Xdebug and the Command +; Line Debug Client. As many clients use this port number, it is best to leave this setting unchanged. +xdebug.client_port= ${XDEBUG_CLIENT_PORT} + + +xdebug.mode = ${XDEBUG_MODE} \ No newline at end of file diff --git a/php/8.1/fpm-alpine-develop/Dockerfile b/php/8.1/fpm-alpine-develop/Dockerfile new file mode 100644 index 0000000..4ad77a2 --- /dev/null +++ b/php/8.1/fpm-alpine-develop/Dockerfile @@ -0,0 +1,41 @@ +FROM graycore/magento-php:8.1-fpm-alpine + +LABEL maintainer="damien@graycore.io" + +# Blackfire +ENV current_os=alpine +RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ + && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/$current_os/amd64/$version \ + && mkdir -p /tmp/blackfire \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \ + && mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \ + && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \ + && rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz + +RUN apk add --no-cache \ + patch + +COPY conf/php.ini /usr/local/etc/php/ + +ENV MAGENTO_USER=app +ENV MAGENTO_USER_UID=1000 +ENV MAGENTO_USER_GID=1000 + +RUN addgroup --gid "$MAGENTO_USER_GID" "$MAGENTO_USER" && adduser \ + --disabled-password \ + --gecos "" \ + --no-create-home \ + --ingroup "$MAGENTO_USER" \ + --uid "$MAGENTO_USER_UID" \ + -h /var/www \ + -s /bin/bash "$MAGENTO_USER" + +RUN mkdir -p /var/www/html + +RUN chown app:app /var/www/html + +USER app:app + +VOLUME /var/www/html + +WORKDIR /var/www/html \ No newline at end of file diff --git a/php/8.1/fpm-alpine-develop/conf/php.ini b/php/8.1/fpm-alpine-develop/conf/php.ini new file mode 100644 index 0000000..b34e6c5 --- /dev/null +++ b/php/8.1/fpm-alpine-develop/conf/php.ini @@ -0,0 +1,17 @@ +memory_limit = 4G +max_execution_time = 30 +zlib.output_compression = On + +date.timezone = UTC +upload_max_filesize = 20M +post_max_size = 20M + +display_errors = stderr +error_log = /dev/stderr +display_startup_errors = On +log_errors = On + +; Where the sendmail program can be found, usually /usr/sbin/sendmail or /usr/lib/sendmail. +; configure does an honest attempt of locating this one for you and set a default, +; but if it fails, you can set it here. +sendmail_path = ${PHP_SENDMAIL_PATH} diff --git a/php/8.1/fpm-alpine-dolphin/Dockerfile b/php/8.1/fpm-alpine-dolphin/Dockerfile new file mode 100644 index 0000000..802e7ac --- /dev/null +++ b/php/8.1/fpm-alpine-dolphin/Dockerfile @@ -0,0 +1,25 @@ +FROM graycore/magento-php:8.1-fpm-alpine + +# Blackfire +ENV current_os=alpine +RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ + && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/$current_os/amd64/$version \ + && mkdir -p /tmp/blackfire \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \ + && mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \ + && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \ + && rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz + +RUN apk add --no-cache \ + openssh patch gnupg git pcre-dev ${PHPIZE_DEPS} \ + && pecl install xdebug \ + && docker-php-ext-enable xdebug \ + && apk del pcre-dev ${PHPIZE_DEPS} + +COPY conf/php.ini /usr/local/etc/php/ + +COPY bin /root/ + +RUN mkdir -p /var/www/html + +WORKDIR /var/www/html diff --git a/php/8.1/fpm-alpine-dolphin/bin/setup.sh b/php/8.1/fpm-alpine-dolphin/bin/setup.sh new file mode 100755 index 0000000..1be933d --- /dev/null +++ b/php/8.1/fpm-alpine-dolphin/bin/setup.sh @@ -0,0 +1,112 @@ +#!/bin/sh +set -e + +SETUP_START=`date +%s` + +# Set the project namespace. +project="$(dirname "$0")" + +source $project/util/welcome.sh +source $project/util/get-domain.sh + +PROJECT_DOMAIN=$(getProjectDomain) + +echo 'move to /var/www/html' +cd /var/www/html +echo 'working from $(pwd)' + +if [ -f 'pub/index.php' ]; then + echo 'Magento Codebase Discovered, Skipping project creation...'; + echo '---------------------------------------------------------'; + welcomeMessage; + SETUP_END=`date +%s` + echo "Setup took: $((SETUP_END-SETUP_START)) seconds..." + exit 0; +elif [ "$COMPOSER_PROJECT_ENABLED" == true ]; then + composer create-project --no-interaction --no-install --repository-url=https://repo.magento.com/ $COMPOSER_PROJECT . + + composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true + composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true + composer config --no-interaction allow-plugins.magento/* true +else + git clone $GIT_REPO --depth=1 .; +fi + +composer install --no-interaction + +bin/magento setup:install \ + --no-interaction \ + --base-url=https://$PROJECT_DOMAIN \ + --db-host=database \ + --db-name=magento2 \ + --db-user=magento2 \ + --db-password=magento2 \ + --admin-firstname=Magento \ + --admin-lastname=User \ + --admin-email=user@example.com \ + --admin-user=$MAGENTO_ADMIN_USERNAME \ + --admin-password=$MAGENTO_ADMIN_PASSWORD \ + --backend-frontname=$MAGENTO_ADMIN_PATH \ + --language=$MAGENTO_LANGUAGE \ + --currency=$MAGENTO_CURRENCY \ + --timezone=$MAGENTO_TIMEZONE \ + --cleanup-database + +bin/magento setup:config:set \ + --no-interaction \ + --cache-backend=redis \ + --cache-backend-redis-server=cache \ + --cache-backend-redis-db=0 + +bin/magento setup:config:set \ + --no-interaction \ + --page-cache=redis \ + --page-cache-redis-server=fullpagecache \ + --page-cache-redis-db=0 + +bin/magento setup:config:set \ + --no-interaction \ + --session-save=redis \ + --session-save-redis-host=sessioncache \ + --session-save-redis-db=0 + +bin/magento setup:config:set \ + --no-interaction \ + --amqp-host='message_queue' \ + --amqp-port='5672' \ + --amqp-user='guest' \ + --amqp-password='guest' + +bin/magento config:set web/url/redirect_to_base 0 + +bin/magento config:set web/seo/use_rewrites 1 + +if [ "$MAGENTO_SAMPLE_DATA" == "venia" ]; then + echo "Installing 'Venia' Sample Data..."; + composer config --no-interaction --ansi repositories.venia-sample-data composer https://repo.magento.com + composer require --no-interaction --ansi magento/venia-sample-data:* + + bin/magento setup:upgrade +elif [ "$MAGENTO_SAMPLE_DATA" == "luma" ]; then + echo "Installing 'Luma' Sample Data..."; + composer suggests --no-interaction --all --list | grep "magento" | grep "sample-data" | xargs -i composer require {} --no-update --no-interaction + composer update --no-interaction + bin/magento setup:upgrade +else + echo "Skipping Sample Data Install..."; +fi + +bin/magento indexer:reindex + +chown www-data:www-data var generated pub/static pub/media app/etc -R + +find var generated pub/static pub/media app/etc -type f -exec chmod g+w {} + + +find var generated pub/static pub/media app/etc -type d -exec chmod g+ws {} + + +bin/magento deploy:mode:set developer + +welcomeMessage; + +SETUP_END=`date +%s` +echo "Setup took: $((SETUP_END-SETUP_START)) seconds..." \ No newline at end of file diff --git a/php/8.1/fpm-alpine-dolphin/bin/util/get-domain.sh b/php/8.1/fpm-alpine-dolphin/bin/util/get-domain.sh new file mode 100644 index 0000000..ae3f51e --- /dev/null +++ b/php/8.1/fpm-alpine-dolphin/bin/util/get-domain.sh @@ -0,0 +1,9 @@ +function getProjectDomain { + if [ -z "$CODESPACE_NAME" ]; then + local __PROJECT_DOMAIN=$MAGENTO_DOMAIN + else + local __PROJECT_DOMAIN="$CODESPACE_NAME-443.githubpreview.dev" + fi + + echo $__PROJECT_DOMAIN +} \ No newline at end of file diff --git a/php/8.1/fpm-alpine-dolphin/bin/util/welcome.sh b/php/8.1/fpm-alpine-dolphin/bin/util/welcome.sh new file mode 100644 index 0000000..4763921 --- /dev/null +++ b/php/8.1/fpm-alpine-dolphin/bin/util/welcome.sh @@ -0,0 +1,15 @@ +function welcomeMessage() { + printf "\n* __ ___ ___ ___ __ " + printf "\n* / |/ /__ ____ ____ |_ |/ _ \___ ____/ /_____ ____ " + printf "\n* / /|_/ / _ \`/ _ \`/ -_) __// // / _ \/ __/ \'_/ -_) __/ " + printf "\n* /_/ /_/\_,_/\_, /\__/____/____/\___/\__/_/\_\\__/_/ " + printf "\n* /___/ " + printf "\n*---------------------------------" + printf "\n* Wake me, when you need me." + printf "\n*" + printf "\n* Visit your store in your browser at https://$PROJECT_DOMAIN" + printf "\n* You can access the Admin UI at https://$PROJECT_DOMAIN/$MAGENTO_ADMIN_PATH" + printf "\n* Username: $MAGENTO_ADMIN_USERNAME" + printf "\n* Password: $MAGENTO_ADMIN_PASSWORD" + printf "\n---------------------------------\n" +} \ No newline at end of file diff --git a/php/8.1/fpm-alpine-dolphin/conf/php.ini b/php/8.1/fpm-alpine-dolphin/conf/php.ini new file mode 100644 index 0000000..b987780 --- /dev/null +++ b/php/8.1/fpm-alpine-dolphin/conf/php.ini @@ -0,0 +1,53 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Stock PHP Settings +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; This sets the maximum amount of memory in bytes that a script is allowed to allocate. +; This helps prevent poorly written scripts for eating up all available memory on a server. +; Note that to have no memory limit, set this directive to -1. +memory_limit = 4G + +; This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. +; This helps prevent poorly written scripts from tying up the server. +; The default setting is 30. When running PHP from the command line the default setting is 0. +max_execution_time = 30 + +date.timezone = UTC + +; The maximum size of an uploaded file. When an integer is used, the value is measured in bytes. +; Shorthand notation may also be used. +upload_max_filesize = 20M + +; Sets max size of post data allowed. This setting also affects file upload. To upload large files, +; this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be +; larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation may also be used. +post_max_size = 20M + +; Whether to transparently compress pages. If this option is set to "On" in php.ini or the Apache configuration, +; pages are compressed if the browser sends an "Accept-Encoding: gzip" or "deflate" header. +; "Content-Encoding: gzip" (respectively "deflate") and "Vary: Accept-Encoding" headers are added to the output. +zlib.output_compression = On + +display_errors = stderr +error_log = /dev/stderr +display_startup_errors = On +log_errors = On + +; Where the sendmail program can be found, usually /usr/sbin/sendmail or /usr/lib/sendmail. +; configure does an honest attempt of locating this one for you and set a default, +; but if it fails, you can set it here. +sendmail_path = ${PHP_SENDMAIL_PATH} + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Xdebug Settings +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Selects the host where the debug client is running, you can either use a host name, IP address, or 'unix:///path/to/sock' +; for a Unix domain socket. This setting is ignored if xdebug.remote_connect_back is enabled. +xdebug.client_host = ${XDEBUG_CLIENT_HOST} + +; The port to which Xdebug tries to connect on the remote host. Port 9003 is the default for both Xdebug and the Command +; Line Debug Client. As many clients use this port number, it is best to leave this setting unchanged. +xdebug.client_port= ${XDEBUG_CLIENT_PORT} + + +xdebug.mode = ${XDEBUG_MODE} \ No newline at end of file diff --git a/php/8.1/fpm-alpine/Dockerfile b/php/8.1/fpm-alpine/Dockerfile new file mode 100644 index 0000000..2b99462 --- /dev/null +++ b/php/8.1/fpm-alpine/Dockerfile @@ -0,0 +1,41 @@ +FROM php:8.1-fpm-alpine + +LABEL maintainer="damien@graycore.io" + +RUN apk add --no-cache \ + gzip \ + freetype-dev \ + icu-dev \ + libjpeg-turbo-dev \ + libpng-dev \ + libxslt-dev \ + lsof \ + curl-dev \ + libzip-dev \ + libsodium-dev \ + mysql-client \ + procps + +# https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html#required-php-extensions +# This layer must be run as one, not two - See: https://github.com/docker-library/php/issues/855 +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \ + && docker-php-ext-install \ + bcmath \ + gd \ + intl \ + opcache \ + pdo_mysql \ + soap \ + xsl \ + zip \ + sockets + +RUN curl -sS https://getcomposer.org/installer | \ + php -- --install-dir=/usr/local/bin --filename=composer && \ + composer self-update + +COPY conf/php.ini /usr/local/etc/php/ + +RUN chmod 775 /var/www/html && chown root:root /var/www/html + +WORKDIR /var/www/html \ No newline at end of file diff --git a/php/8.1/fpm-alpine/conf/php.ini b/php/8.1/fpm-alpine/conf/php.ini new file mode 100644 index 0000000..db31a66 --- /dev/null +++ b/php/8.1/fpm-alpine/conf/php.ini @@ -0,0 +1,84 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Stock PHP Settings +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user. +; Value "stderr" sends the errors to stderr instead of stdout. +display_errors = Off + +; The display of errors which occur during PHP's startup sequence are handled +; separately from display_errors. +display_startup_errors = Off + +; Besides displaying errors, PHP can also log errors to locations such as a +; server-specific log, STDERR, or a location specified by the error_log +; directive found below. +log_errors = On + +; This directive informs PHP of which errors, warnings and notices you would like +; it to take action for. +error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT + +; This sets the maximum amount of memory in bytes that a script is allowed to allocate. +; This helps prevent poorly written scripts for eating up all available memory on a server. +; Note that to have no memory limit, set this directive to -1. +memory_limit = 4G + +; This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. +; This helps prevent poorly written scripts from tying up the server. +; The default setting is 30. When running PHP from the command line the default setting is 0. +max_execution_time = 30 + +; Maximum amount of time each script may spend parsing request data. It's a good +; idea to limit this time on productions servers in order to eliminate unexpectedly +; long running scripts. +max_input_time = 30 + +; The maximum size of an uploaded file. When an integer is used, the value is measured in bytes. +; Shorthand notation may also be used. +upload_max_filesize = 20M + +; Sets max size of post data allowed. This setting also affects file upload. To upload large files, +; this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be +; larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation may also be used. +post_max_size = 20M + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; OPcache Settings +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; Determines if Zend OPCache is enabled +opcache.enable = 1 + +; The maximum number of keys (and therefore scripts) in the OPcache hash table. +; The actual value used will be the first number in the set of prime numbers { 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 } +; that is greater than or equal to the configured value. The minimum value is 200. +; The maximum value is 1000000. Values outside of this range are clamped to the permissible range. +; +; After running some tests on Magento 2 instances, the typical file count is around 30000. We use double, just in case. +opcache.max_accelerated_files = 65407 + +; When enabled, the opcode cache will be checked for whether a file has already been cached when file_exists(), is_file() and is_readable() are called. +; This may increase performance in applications that check the existence and readability of PHP scripts, but risks returning stale data if opcache.validate_timestamps is disabled. +opcache.enable_file_override = 1 + +;The amount of memory used to store interned strings, in megabytes. +opcache.interned_strings_buffer = 32 + +; The size of the shared memory storage used by OPcache, in megabytes. The minimum permissible value is "8", which is enforced if a smaller value is set. +opcache.memory_consumption = 200 + +; How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request. +; This configuration directive is ignored if opcache.validate_timestamps is disabled. + +; If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds. When this directive is disabled, you must reset OPcache manually via opcache_reset(), +; opcache_invalidate() or by restarting the Web server for changes to the filesystem to take effect. +; +; Since we're using a dockerized environment, we're assuming that the final environment is immutable, and therefore validating timestamps +; is unnecessary. +opcache.validate_timestamps = 0 + +; If disabled, all documentation comments will be discarded from the opcode cache to reduce the size of the optimised code. +; Disabling this configuration directive may break applications and frameworks that rely on comment parsing for annotations, +; including Doctrine, Zend Framework 2, PHPUnit, and Magento 2. +opcache.save_comments = 1 \ No newline at end of file