From 863759737bdca5a96c0a753ddcd363d9cc8773a9 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 13:56:19 -0400 Subject: [PATCH 01/13] feat(nginx): add auto-reloading (#64) --- nginx/1.18/alpine-develop/Dockerfile | 10 ++++++++-- nginx/1.18/alpine-develop/scripts/entrypoint.sh | 4 ++++ nginx/1.18/alpine-develop/scripts/nginxReloader.sh | 13 +++++++++++++ nginx/1.19/alpine-develop/Dockerfile | 8 +++++++- nginx/1.19/alpine-develop/scripts/entrypoint.sh | 4 ++++ nginx/1.19/alpine-develop/scripts/nginxReloader.sh | 13 +++++++++++++ 6 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 nginx/1.18/alpine-develop/scripts/entrypoint.sh create mode 100644 nginx/1.18/alpine-develop/scripts/nginxReloader.sh create mode 100644 nginx/1.19/alpine-develop/scripts/entrypoint.sh create mode 100644 nginx/1.19/alpine-develop/scripts/nginxReloader.sh diff --git a/nginx/1.18/alpine-develop/Dockerfile b/nginx/1.18/alpine-develop/Dockerfile index 1d603fa..8ab3735 100644 --- a/nginx/1.18/alpine-develop/Dockerfile +++ b/nginx/1.18/alpine-develop/Dockerfile @@ -2,13 +2,19 @@ FROM nginx:1.18-alpine MAINTAINER Damien Retzinger -RUN apk update && apk add openssl +RUN apk update && apk add --no-cache inotify-tools openssl RUN mkdir /etc/nginx/certs \ && echo -e "\n\n\n\n\n\n\n" | openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/certs/nginx.key -out /etc/nginx/certs/nginx.crt COPY ./conf/nginx.conf /etc/nginx/ COPY ./conf/default.conf.template /etc/nginx/templates/ +COPY scripts/entrypoint.sh /docker-entrypoint.d/ +COPY scripts/nginxReloader.sh /root/scripts/ + +RUN chmod +x /docker-entrypoint.d/entrypoint.sh +RUN chmod +x /root/scripts/nginxReloader.sh + ENV MAGENTO2_UPSTREAM=localhost ENV MAGENTO2_UPSTREAM_PORT=9000 ENV NGINX_PORT=8000 @@ -16,4 +22,4 @@ ENV NGINX_TLS_PORT=8443 EXPOSE 8443 -WORKDIR /var/www/html +WORKDIR /var/www/html \ No newline at end of file diff --git a/nginx/1.18/alpine-develop/scripts/entrypoint.sh b/nginx/1.18/alpine-develop/scripts/entrypoint.sh new file mode 100644 index 0000000..55e785e --- /dev/null +++ b/nginx/1.18/alpine-develop/scripts/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +sh -c "/root/scripts/nginxReloader.sh &" \ No newline at end of file diff --git a/nginx/1.18/alpine-develop/scripts/nginxReloader.sh b/nginx/1.18/alpine-develop/scripts/nginxReloader.sh new file mode 100644 index 0000000..aba8a3b --- /dev/null +++ b/nginx/1.18/alpine-develop/scripts/nginxReloader.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +while true +do + inotifywait --include="(nginx\.conf\.sample|nginx\.conf)" -e create -e modify -e delete -e move /var/www/html/ + nginx -t + if [ $? -eq 0 ] + then + echo "Detected Nginx Configuration Change" + echo "Executing: nginx -s reload" + nginx -s reload + fi +done \ No newline at end of file diff --git a/nginx/1.19/alpine-develop/Dockerfile b/nginx/1.19/alpine-develop/Dockerfile index 397e34a..6f63fe1 100644 --- a/nginx/1.19/alpine-develop/Dockerfile +++ b/nginx/1.19/alpine-develop/Dockerfile @@ -2,13 +2,19 @@ FROM nginx:1.19-alpine MAINTAINER Damien Retzinger -RUN apk update && apk add openssl +RUN apk update && apk add --no-cache inotify-tools openssl RUN mkdir /etc/nginx/certs \ && echo -e "\n\n\n\n\n\n\n" | openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/certs/nginx.key -out /etc/nginx/certs/nginx.crt COPY ./conf/nginx.conf /etc/nginx/ COPY ./conf/default.conf.template /etc/nginx/templates/ +COPY scripts/entrypoint.sh /docker-entrypoint.d/ +COPY scripts/nginxReloader.sh /root/scripts/ + +RUN chmod +x /docker-entrypoint.d/entrypoint.sh +RUN chmod +x /root/scripts/nginxReloader.sh + ENV MAGENTO2_UPSTREAM=localhost ENV MAGENTO2_UPSTREAM_PORT=9000 ENV NGINX_PORT=8000 diff --git a/nginx/1.19/alpine-develop/scripts/entrypoint.sh b/nginx/1.19/alpine-develop/scripts/entrypoint.sh new file mode 100644 index 0000000..55e785e --- /dev/null +++ b/nginx/1.19/alpine-develop/scripts/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +sh -c "/root/scripts/nginxReloader.sh &" \ No newline at end of file diff --git a/nginx/1.19/alpine-develop/scripts/nginxReloader.sh b/nginx/1.19/alpine-develop/scripts/nginxReloader.sh new file mode 100644 index 0000000..aba8a3b --- /dev/null +++ b/nginx/1.19/alpine-develop/scripts/nginxReloader.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +while true +do + inotifywait --include="(nginx\.conf\.sample|nginx\.conf)" -e create -e modify -e delete -e move /var/www/html/ + nginx -t + if [ $? -eq 0 ] + then + echo "Detected Nginx Configuration Change" + echo "Executing: nginx -s reload" + nginx -s reload + fi +done \ No newline at end of file From db7a9501f448b9b38a344aa30418c4b63c1624de Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:00:35 -0400 Subject: [PATCH 02/13] feat(php): add new dolphin base images for php 7.2, 7.3, and 7.4 (#64) Co-authored-by: Mateus Dutra Dadalto --- php/7.2/fpm-alpine-dolphin/Dockerfile | 28 +++++ php/7.2/fpm-alpine-dolphin/bin/setup.sh | 108 +++++++++++++++++ .../fpm-alpine-dolphin/bin/util/get-domain.sh | 9 ++ .../fpm-alpine-dolphin/bin/util/welcome.sh | 15 +++ php/7.2/fpm-alpine-dolphin/conf/php.ini | 68 +++++++++++ php/7.3/fpm-alpine-dolphin/Dockerfile | 25 ++++ php/7.3/fpm-alpine-dolphin/bin/setup.sh | 108 +++++++++++++++++ .../fpm-alpine-dolphin/bin/util/get-domain.sh | 9 ++ .../fpm-alpine-dolphin/bin/util/welcome.sh | 15 +++ php/7.3/fpm-alpine-dolphin/conf/php.ini | 53 +++++++++ php/7.4/fpm-alpine-dolphin/Dockerfile | 25 ++++ php/7.4/fpm-alpine-dolphin/bin/setup.sh | 112 ++++++++++++++++++ .../fpm-alpine-dolphin/bin/util/get-domain.sh | 9 ++ .../fpm-alpine-dolphin/bin/util/welcome.sh | 15 +++ php/7.4/fpm-alpine-dolphin/conf/php.ini | 53 +++++++++ 15 files changed, 652 insertions(+) create mode 100644 php/7.2/fpm-alpine-dolphin/Dockerfile create mode 100755 php/7.2/fpm-alpine-dolphin/bin/setup.sh create mode 100644 php/7.2/fpm-alpine-dolphin/bin/util/get-domain.sh create mode 100644 php/7.2/fpm-alpine-dolphin/bin/util/welcome.sh create mode 100644 php/7.2/fpm-alpine-dolphin/conf/php.ini create mode 100644 php/7.3/fpm-alpine-dolphin/Dockerfile create mode 100755 php/7.3/fpm-alpine-dolphin/bin/setup.sh create mode 100644 php/7.3/fpm-alpine-dolphin/bin/util/get-domain.sh create mode 100644 php/7.3/fpm-alpine-dolphin/bin/util/welcome.sh create mode 100644 php/7.3/fpm-alpine-dolphin/conf/php.ini create mode 100644 php/7.4/fpm-alpine-dolphin/Dockerfile create mode 100755 php/7.4/fpm-alpine-dolphin/bin/setup.sh create mode 100644 php/7.4/fpm-alpine-dolphin/bin/util/get-domain.sh create mode 100644 php/7.4/fpm-alpine-dolphin/bin/util/welcome.sh create mode 100644 php/7.4/fpm-alpine-dolphin/conf/php.ini diff --git a/php/7.2/fpm-alpine-dolphin/Dockerfile b/php/7.2/fpm-alpine-dolphin/Dockerfile new file mode 100644 index 0000000..9e797df --- /dev/null +++ b/php/7.2/fpm-alpine-dolphin/Dockerfile @@ -0,0 +1,28 @@ +FROM graycore/magento-php:7.2-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 \ + openssh patch gnupg git pcre-dev ${PHPIZE_DEPS} \ + && pecl install xdebug-2.9.8 \ + && 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 \ No newline at end of file diff --git a/php/7.2/fpm-alpine-dolphin/bin/setup.sh b/php/7.2/fpm-alpine-dolphin/bin/setup.sh new file mode 100755 index 0000000..4d8a676 --- /dev/null +++ b/php/7.2/fpm-alpine-dolphin/bin/setup.sh @@ -0,0 +1,108 @@ +#!/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) + +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-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 + +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 --all --list | grep "magento" | grep "sample-data" | xargs -i composer require {} --no-update + composer update + 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/7.2/fpm-alpine-dolphin/bin/util/get-domain.sh b/php/7.2/fpm-alpine-dolphin/bin/util/get-domain.sh new file mode 100644 index 0000000..ae3f51e --- /dev/null +++ b/php/7.2/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/7.2/fpm-alpine-dolphin/bin/util/welcome.sh b/php/7.2/fpm-alpine-dolphin/bin/util/welcome.sh new file mode 100644 index 0000000..4763921 --- /dev/null +++ b/php/7.2/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/7.2/fpm-alpine-dolphin/conf/php.ini b/php/7.2/fpm-alpine-dolphin/conf/php.ini new file mode 100644 index 0000000..8d089af --- /dev/null +++ b/php/7.2/fpm-alpine-dolphin/conf/php.ini @@ -0,0 +1,68 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; 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.remote_host = ${XDEBUG_REMOTE_HOST} + +; The port to which Xdebug tries to connect on the remote host. Port 9000 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.remote_port= ${XDEBUG_REMOTE_PORT} + +; This switch controls whether Xdebug should try to contact a debug client which is listening on the host and port as set +; with the settings xdebug.remote_host and xdebug.remote_port. If a connection can not be established the script will +; just continue as if this setting was 0. +xdebug.remote_enable = 1 + +; Normally you need to use a specific HTTP GET/POST variable to start remote debugging (see Step Debugging). When this +; setting is set to 1, Xdebug will always attempt to start a remote debugging session and try to connect to a client, +; even if the GET/POST/COOKIE variable was not present. +xdebug.remote_autostart = 1 + +; If this setting is set to false, then Xdebug will not set-up internal structures to allow code coverage. +; This speeds up Xdebug quite a bit, but of course, Code Coverage Analysis won't work. +xdebug.coverage_enable = 0 + +; If this setting is 1, then stacktraces will be shown by default on an error event. You can disable showing stacktraces +; from your code with xdebug_disable(). +xdebug.default_enable = 0 \ No newline at end of file diff --git a/php/7.3/fpm-alpine-dolphin/Dockerfile b/php/7.3/fpm-alpine-dolphin/Dockerfile new file mode 100644 index 0000000..9285517 --- /dev/null +++ b/php/7.3/fpm-alpine-dolphin/Dockerfile @@ -0,0 +1,25 @@ +FROM graycore/magento-php:7.3-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/7.3/fpm-alpine-dolphin/bin/setup.sh b/php/7.3/fpm-alpine-dolphin/bin/setup.sh new file mode 100755 index 0000000..4d8a676 --- /dev/null +++ b/php/7.3/fpm-alpine-dolphin/bin/setup.sh @@ -0,0 +1,108 @@ +#!/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) + +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-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 + +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 --all --list | grep "magento" | grep "sample-data" | xargs -i composer require {} --no-update + composer update + 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/7.3/fpm-alpine-dolphin/bin/util/get-domain.sh b/php/7.3/fpm-alpine-dolphin/bin/util/get-domain.sh new file mode 100644 index 0000000..ae3f51e --- /dev/null +++ b/php/7.3/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/7.3/fpm-alpine-dolphin/bin/util/welcome.sh b/php/7.3/fpm-alpine-dolphin/bin/util/welcome.sh new file mode 100644 index 0000000..4763921 --- /dev/null +++ b/php/7.3/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/7.3/fpm-alpine-dolphin/conf/php.ini b/php/7.3/fpm-alpine-dolphin/conf/php.ini new file mode 100644 index 0000000..b987780 --- /dev/null +++ b/php/7.3/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/7.4/fpm-alpine-dolphin/Dockerfile b/php/7.4/fpm-alpine-dolphin/Dockerfile new file mode 100644 index 0000000..1f60b60 --- /dev/null +++ b/php/7.4/fpm-alpine-dolphin/Dockerfile @@ -0,0 +1,25 @@ +FROM graycore/magento-php:7.4-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/7.4/fpm-alpine-dolphin/bin/setup.sh b/php/7.4/fpm-alpine-dolphin/bin/setup.sh new file mode 100755 index 0000000..1be933d --- /dev/null +++ b/php/7.4/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/7.4/fpm-alpine-dolphin/bin/util/get-domain.sh b/php/7.4/fpm-alpine-dolphin/bin/util/get-domain.sh new file mode 100644 index 0000000..ae3f51e --- /dev/null +++ b/php/7.4/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/7.4/fpm-alpine-dolphin/bin/util/welcome.sh b/php/7.4/fpm-alpine-dolphin/bin/util/welcome.sh new file mode 100644 index 0000000..4763921 --- /dev/null +++ b/php/7.4/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/7.4/fpm-alpine-dolphin/conf/php.ini b/php/7.4/fpm-alpine-dolphin/conf/php.ini new file mode 100644 index 0000000..b987780 --- /dev/null +++ b/php/7.4/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 From 9020d1eca8856fac1052791810ca5b6609c6c801 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:02:52 -0400 Subject: [PATCH 03/13] feat(env): add revised ENV for dolphin (#64) --- .env.sample | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.env.sample b/.env.sample index f78c0b3..e956323 100644 --- a/.env.sample +++ b/.env.sample @@ -13,6 +13,8 @@ COMPOSE_PROJECT_NAME=YOUR_PROJECT_NAME # Docker Compose File # See https://docs.docker.com/compose/reference/envvars/#compose_file # * Note that you can safely switch 2.3 with another release line of Magento2. e.g. 2.4 +# * Legacy (Deprecated) +# * See: "Dolphin" https://github.com/graycoreio/mage2docker/tree/master/docs/stories/dolphin.md ########### # Mac # COMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/docker-compose.partialsync.yml @@ -20,5 +22,66 @@ COMPOSE_PROJECT_NAME=YOUR_PROJECT_NAME # Windows (WSL) and Linux # COMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/docker-compose.fullsync.yml +# Agnostic (Dolphin) +# COMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/containersync.yml +########################################################################## +# Whether or not to use the composer project as a basis for the project, or a git repo. +# You should likely only need this when creating a green-lawn project or you're testing a release. +########### +COMPOSER_PROJECT_ENABLED=true + +########################################################################## +# The Composer Project to install. Note, that on certain PHP versions, the glob +# syntax does not work, so you may need to specify an exact version. +# Ignored unless COMPOSER_PROJECT_ENABLED is `true`. +########### +COMPOSER_PROJECT=magento/project-community-edition=2.4.* + +########################################################################## +# The git repo representing the Magento 2 project. +# Ignored unless COMPOSER_PROJECT_ENABLED is `false`. +########### +GIT_REPO=https://github.com/magento/magento2.git +########################################################################## +# The domain used to serve the app in the local environment. +########### +MAGENTO_DOMAIN=magento2.test + +########################################################################## +# The path where the admin UI can be located. +########### +MAGENTO_ADMIN_PATH=admin + +########################################################################## +# The admin username. +########### +MAGENTO_ADMIN_USERNAME=admin + +########################################################################## +# The admin password. +########### +MAGENTO_ADMIN_PASSWORD=admin123 + +########################################################################## +# The default Language of Magento. +########### +MAGENTO_LANGUAGE=en_US + +########################################################################## +# The currency of Magento. +########### +MAGENTO_CURRENCY=USD + +########################################################################## +# The timezone of Magento. +########### +MAGENTO_TIMEZONE="America/Chicago" + +########################################################################## +# Whether or not to use sample data. By default, we use Venia. +# Supported values include 'venia', 'luma', 'none' +# Default: 'venia' +########### +MAGENTO_SAMPLE_DATA="venia" \ No newline at end of file From 35fe4dbc783e400638c204e6dba2b0e470933ade Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:03:37 -0400 Subject: [PATCH 04/13] feat(sync): add new container sync strategy (#64) --- compose/sync/containersync.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 compose/sync/containersync.yml diff --git a/compose/sync/containersync.yml b/compose/sync/containersync.yml new file mode 100644 index 0000000..1d86e7c --- /dev/null +++ b/compose/sync/containersync.yml @@ -0,0 +1,11 @@ +version : '3' + +services: + magento2: + volumes: &appvolumes + - appdata:/var/www/html + - ~/.composer:/root/.composer:delegated + ingress: + volumes: *appvolumes +volumes: + appdata: From 93723f8d47f7c20c9f24e5b7b8f7088c8e33935c Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:04:41 -0400 Subject: [PATCH 05/13] ci: add new docker image publish for dolphin images (#64) Co-authored-by: Mateus Dutra Dadalto --- .github/workflows/docker-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index d4e192e..e543f48 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: php: [7.2, 7.3, 7.4] - kind: [fpm-alpine, fpm-alpine-develop, fpm-alpine-develop-xdebug, cli-alpine] + kind: [fpm-alpine, fpm-alpine-develop, fpm-alpine-develop-xdebug, fpm-alpine-dolphin, cli-alpine] runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 From 29852a83e12a8cb5215b09d76cd0067817aa2414 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:05:21 -0400 Subject: [PATCH 06/13] build: add nice recommendations for working on Mage2Docker (#64) --- .vscode/extensions.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..1d51d04 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + "recommendations": [ + "ms-vsliveshare.vsliveshare", + "ms-vscode-remote.remote-containers", + "ms-vscode-remote.remote-ssh", + "ms-vscode-remote.remote-ssh-edit", + "ms-vscode-remote.vscode-remote-extensionpack", + "eamodio.gitlens", + "redhat.vscode-yaml", + ] +} \ No newline at end of file From d4d1c7892136c65e6a322a3839e5231fa34064f2 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:09:11 -0400 Subject: [PATCH 07/13] feat(php): add, use new configurations for dolphin php (#64) BREAKING CHANGES: the base image for most environments has changed from alpine-develop to dolphin, which is still alpine based. Most thing should work the same, but this could be breaking for you. Co-authored-by: Mateus Dutra Dadalto Co-authored-by: Nolan Arnold <44958241+Nolan-Arnold@users.noreply.github.com> --- compose/base/2.3.yml | 4 ++-- compose/base/2.4.yml | 14 ++++++++++++-- compose/php/7.2/7.2-dolphin.yml | 8 ++++++++ compose/php/7.3/7.3-dolphin.yml | 9 +++++++++ compose/php/7.4/7.4-dolphin.yml | 9 +++++++++ 5 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 compose/php/7.2/7.2-dolphin.yml create mode 100644 compose/php/7.3/7.3-dolphin.yml create mode 100644 compose/php/7.4/7.4-dolphin.yml diff --git a/compose/base/2.3.yml b/compose/base/2.3.yml index 4a86bca..23d0a6f 100644 --- a/compose/base/2.3.yml +++ b/compose/base/2.3.yml @@ -5,14 +5,14 @@ services: extends: file: ./compose/base/base.yml service: ingress - image: graycore/magento-nginx:1.18-alpine-develop + image: graycore/magento-nginx:1.18-alpine-develop-v6.0.0-alpha.2 depends_on: - magento2 magento2: extends: file: ./compose/base/base.yml service: magento2 - image: graycore/magento-php:7.3-fpm-alpine-develop + image: graycore/magento-php:7.4-fpm-alpine-dolphin-v6.0.0-alpha.2 environment: - CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH6_SERVER_HOSTNAME=elasticsearch - CONFIG__DEFAULT__CATALOG__SEARCH__ENGINE=elasticsearch6 diff --git a/compose/base/2.4.yml b/compose/base/2.4.yml index f03d626..4a7f8c8 100644 --- a/compose/base/2.4.yml +++ b/compose/base/2.4.yml @@ -5,18 +5,22 @@ services: extends: file: ./compose/base/base.yml service: ingress - image: graycore/magento-nginx:1.18-alpine-develop + image: graycore/magento-nginx:1.18-alpine-develop-v6.0.0-alpha.2 depends_on: - magento2 magento2: extends: file: ./compose/base/base.yml service: magento2 - image: graycore/magento-php:7.4-fpm-alpine-develop + image: graycore/magento-php:7.4-fpm-alpine-dolphin-v6.0.0-alpha.2 environment: - CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH7_SERVER_HOSTNAME=elasticsearch - CONFIG__DEFAULT__CATALOG__SEARCH__ENGINE=elasticsearch7 - CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH7_SERVER_PORT=9200 + - PHP_SENDMAIL_PATH=/usr/sbin/sendmail -S mailhog:1025 + - XDEBUG_CLIENT_PORT=9003 + - XDEBUG_CLIENT_HOST=localhost + - XDEBUG_MODE=debug database: extends: file: ./compose/base/base.yml @@ -54,6 +58,12 @@ services: resources: limits: memory: 2G + mailhog: + extends: + file: ./compose/mailhog/1.0.yaml + service: mailhog + networks: + - backend networks: frontend: backend: diff --git a/compose/php/7.2/7.2-dolphin.yml b/compose/php/7.2/7.2-dolphin.yml new file mode 100644 index 0000000..08242ed --- /dev/null +++ b/compose/php/7.2/7.2-dolphin.yml @@ -0,0 +1,8 @@ +version: "3" + +services: + magento2: + image: graycore/magento-php:7.2-fpm-alpine-dolphin-v6.0.0-alpha.2 + environment: + XDEBUG_REMOTE_PORT: "9002" + XDEBUG_REMOTE_HOST: "localhost" \ No newline at end of file diff --git a/compose/php/7.3/7.3-dolphin.yml b/compose/php/7.3/7.3-dolphin.yml new file mode 100644 index 0000000..33ad158 --- /dev/null +++ b/compose/php/7.3/7.3-dolphin.yml @@ -0,0 +1,9 @@ +version: "3" + +services: + magento2: + image: graycore/magento-php:7.3-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/7.4/7.4-dolphin.yml b/compose/php/7.4/7.4-dolphin.yml new file mode 100644 index 0000000..b918f03 --- /dev/null +++ b/compose/php/7.4/7.4-dolphin.yml @@ -0,0 +1,9 @@ +version: "3" + +services: + magento2: + image: graycore/magento-php:7.4-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 From c999ac265b10c5db3e69370206bccc040e6571f9 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:10:21 -0400 Subject: [PATCH 08/13] fix: dont restart mysql always, only on failure (#44) Co-authored-by: Nolan Arnold <44958241+Nolan-Arnold@users.noreply.github.com> --- compose/base/base.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose/base/base.yml b/compose/base/base.yml index 957d2d8..f58c8dc 100644 --- a/compose/base/base.yml +++ b/compose/base/base.yml @@ -13,7 +13,7 @@ services: - NGINX_PORT=8000 - NGINX_TLS_PORT=8443 magento2: - restart: always + restart: on-failure networks: - frontend - backend @@ -22,7 +22,7 @@ services: database: volumes: - db_data:/var/lib/mysql - restart: always + restart: on-failure environment: MYSQL_ROOT_PASSWORD: magento2 MYSQL_DATABASE: magento2 From ba7ca69ea2fca40a2b79786db7db97ec0b759c03 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:10:52 -0400 Subject: [PATCH 09/13] test: add a CI pipeline to verify that installation works (#64) Co-authored-by: Mateus Dutra Dadalto --- .github/workflows/startup/configure.sh | 20 ++++++++++++ .github/workflows/test-env-startup.yml | 43 ++++++++++++++++++++++++++ compose/php/7.2/build.yml | 6 ++++ compose/php/7.3/build.yml | 6 ++++ compose/php/7.4/build.yml | 6 ++++ 5 files changed, 81 insertions(+) create mode 100755 .github/workflows/startup/configure.sh create mode 100644 .github/workflows/test-env-startup.yml create mode 100644 compose/php/7.2/build.yml create mode 100644 compose/php/7.3/build.yml create mode 100644 compose/php/7.4/build.yml diff --git a/.github/workflows/startup/configure.sh b/.github/workflows/startup/configure.sh new file mode 100755 index 0000000..30a8951 --- /dev/null +++ b/.github/workflows/startup/configure.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +MAGENTO_VERSION_2_3='magento/project-community-edition=2.3.*' +MAGENTO_VERSION_2_4='magento/project-community-edition=2.4.*' + +case "$COMPOSER_PROJECT" in + "$MAGENTO_VERSION_2_3") + printf "\\n\\nCOMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/containersync.yml:compose/php/7.4/build.yml" >> .env + sed -i -e "s|^[#]*\s*COMPOSER_PROJECT=.*|COMPOSER_PROJECT="$COMPOSER_PROJECT"|" .env + ;; + $MAGENTO_VERSION_2_4) + printf "\\n\\nCOMPOSE_FILE=docker-compose.yml:./compose/base/2.4.yml:compose/sync/containersync.yml:compose/php/7.4/build.yml" >> .env + sed -i -e "s|^[#]*\s*COMPOSER_PROJECT=.*|COMPOSER_PROJECT="$COMPOSER_PROJECT"|" .env + ;; + *) + printf "Unknown Magento version" + exit 1; + ;; +esac \ No newline at end of file diff --git a/.github/workflows/test-env-startup.yml b/.github/workflows/test-env-startup.yml new file mode 100644 index 0000000..c3578ae --- /dev/null +++ b/.github/workflows/test-env-startup.yml @@ -0,0 +1,43 @@ +name: Validate The Environment + +on: + pull_request: + paths-ignore: + - "docs/**" + - README.md + branches: + - dolphin + - master + +jobs: + run: + strategy: + matrix: + COMPOSER_PROJECT: ["magento/project-community-edition=2.3.*", "magento/project-community-edition=2.4.*"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ matrix.COMPOSER_PROJECT }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Add HTTP basic auth credentials for composer + run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > ~/.composer/auth.json + - name: Define the .env + run: mv .env.sample .env + - name: Configure the .env + run: .github/workflows/startup/configure.sh + env: + COMPOSER_PROJECT: ${{ matrix.COMPOSER_PROJECT }} + - name: Build the stack + run: docker-compose up -d + - name: Run the setup scripts + run: docker exec mage2docker_magento2_1 /bin/sh /root/setup.sh + - name: Test + run: docker run --network container:mage2docker_ingress_1 curlimages/curl -ksf --retry 10 --retry-connrefused https://ingress:8443 diff --git a/compose/php/7.2/build.yml b/compose/php/7.2/build.yml new file mode 100644 index 0000000..ee4f4e0 --- /dev/null +++ b/compose/php/7.2/build.yml @@ -0,0 +1,6 @@ +version : '3' + +services: + magento2: + build: php/7.2/fpm-alpine-dolphin + image: graycore/magento-php:build diff --git a/compose/php/7.3/build.yml b/compose/php/7.3/build.yml new file mode 100644 index 0000000..5046870 --- /dev/null +++ b/compose/php/7.3/build.yml @@ -0,0 +1,6 @@ +version : '3' + +services: + magento2: + build: php/7.3/fpm-alpine-dolphin + image: graycore/magento-php:build diff --git a/compose/php/7.4/build.yml b/compose/php/7.4/build.yml new file mode 100644 index 0000000..6981e28 --- /dev/null +++ b/compose/php/7.4/build.yml @@ -0,0 +1,6 @@ +version : '3' + +services: + magento2: + build: php/7.4/fpm-alpine-dolphin + image: graycore/magento-php:build From 708fbe715d9c661ceab43d81a4f88d062728be99 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:11:30 -0400 Subject: [PATCH 10/13] feat: add a devcontainer.json that uses dolphin (#64) Co-authored-by: Mateus Dutra Dadalto --- .devcontainer/devcontainer.json | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..e345390 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,36 @@ +{ + "workspaceFolder": "/var/www/html", + "forwardPorts": [ + 80, + 443, + 8025 + ], + "extensions": [ + "bmewburn.vscode-intelephense-client", + "felixfbecker.php-debug", + "ikappas.phpcs", + "neilbrayfield.php-docblocker", + "valeryanm.vscode-phpsab" + ], + "service": "magento2", + "shutdownAction": "stopCompose", + "dockerComposeFile": [ + "../docker-compose.yml", + "../compose/base/2.4.yml", + "../compose/sync/containersync.yml" + ], + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "sh", + "icon": "terminal-linux" + } + } + }, + "initializeCommand": "cp -u .env.sample .env", + "postCreateCommand": [ + "/bin/sh", + "-c", + "/root/setup.sh" + ] +} \ No newline at end of file From 064e3d786e839d7140c383ccdaaa18e28786821f Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:11:50 -0400 Subject: [PATCH 11/13] docs: revise docs for dolphin (#64) --- README.md | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d798a5f..6ebc2a6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > Get rid of your "it works on my machine" arguments. -This project intends to create an opinionated, performant, replicable, and production-like Magento 2 local development environment that leverages Docker. +This project intends to create an opinionated, performant, replicable, and production-like Magento 2 local development environment that leverages [Docker](https://www.docker.com/), [VSCode](https://code.visualstudio.com/) and [devcontainers](https://code.visualstudio.com/docs/remote/containers). [![graycore/magento2-php pulls](https://img.shields.io/docker/pulls/graycore/magento-php.svg?label=magento-php%20docker%20pulls)](https://hub.docker.com/r/graycore/magento-php) [![Mage2Docker Commit Activity](https://img.shields.io/badge/maintained%3F-yes-brightgreen.svg)](https://github.com/graycoreop/mage2docker/graphs/commit-activity) @@ -20,33 +20,37 @@ This project intends to create an opinionated, performant, replicable, and produ |-----------------|---------------------|---------------------| | 2.2.* | N/A | Dec 2019 | | <2.3.7 | v4.1.0 | Apr 2022 | -| >=2.3.7 | v5.0.0 | Apr 2022 | +| >=2.3.7 | >v5.0.0 | Apr 2022 | | 2.4.0 | v4.1.0 | Nov 2022 | | 2.4.1 | v4.1.0 | Nov 2022 | -| 2.4.2 | v5.0.0 | Nov 2022 | -| 2.4.3 | v5.0.0 | Nov 2022 | +| 2.4.2 | >v5.0.0 | Nov 2022 | +| 2.4.3 | >v5.0.0 | Nov 2022 | -## Getting Started -To get started, pick your operating system from the list below. Don't see yours? [Make an issue.](https://github.com/graycoreio/mage2docker/issues/new?assignees=damienwebdev&labels=feat&template=feature_request.md&title=%5BFEAT%5D) +### Dolphin +As of Mage2Docker v6.0.0, Dolphin is the new fully cross-platform Mage2docker environment that leverages VSCode `devcontainers` or Github Codespaces. -## Supported Platforms -* [Windows via WSL2](./docs/platforms/windows.md) -* [MacOS](./docs/platforms/macos.md) -* [Linux - Ubuntu](./docs/platforms/ubuntu.md) +To get started, see [the new significantly smoother installation process. We strongly encourage you to use it](./docs/stories/dolphin.md). + +For those users curious on why we've made these changes, [please read the architecture discussion.](./docs/arch/dolphin.md) ## Prerequisites #### Hardware -* 16GB RAM -* 4 Cores +* 4GB RAM +* 2 Cores ## Features * :clock1: [**5 Minute** Setup](#supported-platforms) + * :octocat: Bring your own repo (BYOR) + * :biohazard: Use Magento Source Code + * :violin: Using [Composer](https://getcomposer.org/) * :fire: Fast (~250ms Response Times Out-of-the-box) * :evergreen_tree: Alpine Linux * :grin: [Semver Compliant](https://semver.org/) -* :lock: [Local TLS Certificates](./docs/stories/ssl/making-tls-work-locally.md) -* :gear: [Infinitely Configurable](./docs/stories/configuring.md) * Magento 2 Open Source & Commerce (Not Cloud) Support * If you're using cloud, please use the ["Cloud Docker" project created by Adobe](https://devdocs.magento.com/cloud/docker/docker-config.html) +* :lock: [Local TLS Certificates](./docs/stories/ssl/making-tls-work-locally.md) +* :gear: [Infinitely Configurable](./docs/stories/configuring.md) +* [VSCode](https://code.visualstudio.com/) +* [Codespaces ready](https://github.com/features/codespaces) From 9e06ad437426b4529a7926a8772db9db82ba689a Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:12:23 -0400 Subject: [PATCH 12/13] docs: revise docs for dolphin (#64) --- docs/arch/dolphin.md | 29 +++++++ .../debugging/vscode/launch.json.dolphin | 23 ++++++ docs/stories/dolphin.md | 82 +++++++++++++++++++ docs/stories/existing-project.md | 2 + docs/stories/reinstalling.md | 6 +- 5 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 docs/arch/dolphin.md create mode 100644 docs/stories/debugging/vscode/launch.json.dolphin create mode 100644 docs/stories/dolphin.md diff --git a/docs/arch/dolphin.md b/docs/arch/dolphin.md new file mode 100644 index 0000000..7cca47d --- /dev/null +++ b/docs/arch/dolphin.md @@ -0,0 +1,29 @@ +# Dolphin + +Dolphin is the next step forward in Mage2Docker local development environments. It's all the things you liked, without all the things you hated. We're using Dolphin to move forward to meet the original promise of "it just 'works' on all machines". + +## The Problem + +For the longest time, Graycore engineers (and external users who use Mage2Docker) have had to suffer mechanical differences between local Magento 2 environments depending upon which operating system that developer happens to be using. + +For example, MacOS developers had to either have both PHP and Composer installed in their host environments or [suffer the wrath of Docker-for-Mac file system performance issues.](https://github.com/docker/roadmap/issues/7) + +Developers working on Windows had to use WSL2 in order to get started. While WSL2 is a wonderful product, it adds additional complexity on top of an already complicated setup, further the barrier to entry to Magento development. + +Finally, for all three platforms, file-system permissions as a result of file mounting behaviors per platform were **the norm not the exception**, ultimately frustrating everyone involved. + +What had started as a "clone once, run everywhere" system was overly complicated and the abstraction behind it was extremely leaky. + +Queue 2021. Github CodeSpaces have become more and more common, and many users who previously leveraged PHPStorm to develop Magento 2 are happily switching over to VSCode because, for your average Magento user, the utility was the same (or greater), without the associated recurring license fee. + +As such, we feel like it is time to attempt to solve our cross-platform local development environment problems a different way. + +## The solution + +With the Mage2Docker Dolphin project, we've managed to finally abstract away the platform problem by leveraging VSCode's [Devcontainers](https://code.visualstudio.com/docs/remote/containers) or (if you have access to it) [Github Codespaces](https://github.com/features/codespaces). + +You can now TRULY develop cross-platform without concerning yourself with the underlying system behavior as you actually work directly inside the docker container, taking the guarantee of reproducible environments that were previously relegated to production environments to your local environment . + +## Trying it out + +So, that's a lot of talk and, as devs, we know [that the proof is in the pudding - let's get started](../stories/dolphin.md). \ No newline at end of file diff --git a/docs/stories/debugging/vscode/launch.json.dolphin b/docs/stories/debugging/vscode/launch.json.dolphin new file mode 100644 index 0000000..7102ba6 --- /dev/null +++ b/docs/stories/debugging/vscode/launch.json.dolphin @@ -0,0 +1,23 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Listen for XDebug", + "hostname": "localhost", + "type": "php", + "request": "launch", + "port": 9003, + "pathMappings": { + "/var/www/html": "${workspaceRoot}" + }, + "xdebugSettings": { + "max_data": 1000, + "max_children": 50, + "max_depth": 3 + } + } + ] +} \ No newline at end of file diff --git a/docs/stories/dolphin.md b/docs/stories/dolphin.md new file mode 100644 index 0000000..5af4f57 --- /dev/null +++ b/docs/stories/dolphin.md @@ -0,0 +1,82 @@ +### Prerequisites + +* Docker +* Git +* VSCode + +### Clone Mage2Docker + +Mage2Docker defines a `docker-compose` environment for you. As such, we start by cloning the environment in your terminal of choice. + +```bash +git clone https://www.github.com/graycoreio/mage2docker \ + && cd mage2docker +``` + +### Setting up your Magento Account +[The process of creating a Magento account is fully documented by Magento and you should follow their process](https://docs.magento.com/m2/ce/user_guide/magento/magento-account-create.html). + +### Configuring Composer +In case you have not done so, we will add your Magento composer authentication credentials to your user's local `auth.json`. + +First check to see if you have a credentials file under `~/.composer/auth.json`. + +```bash +cat ~/.composer/auth.json +``` + +If you have a `auth.json` file here, you have most likely already configured your credentials and can skip to the next step. + +If you don't see your credentials there, [you can follow the Magento 2 guide to find your credentials](https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html) and copy the `auth.json.sample` [found in the Magento 2 repo](https://github.com/magento/magento2/blob/2.4-develop/auth.json.sample) to your user's `auth.json` file: `~/.composer/auth.json` file and fill out the required credentials. + +```bash +cp /path/to/magento/project/auth.json.sample ~/.composer/auth.json +``` + +### Per-project configuration +We recommend using `auth.json` in your user's directory, but when you're working on multiple Magento 2 applications at once, you may need multiple `auth.json`. You can simply add the `auth.json` to the root of your Magento 2 project after project creation, and composer will use those credentials instead. + +### Configuring Docker Compose +Mage2Docker comes with a basic environment configuration file `.env.sample`, you can utilize this file to tailor your environment to your needs. + +#### Copy this file into a new `.env` file.** + +```bash +cp .env.sample .env +``` + +You will need to uncomment the following configurations and select the [appropriate configurations](./configuring.md) for your environment. We've configured some basic defaults for out-of-the-box behavior. + +```bash +COMPOSE_PROJECT_NAME +``` + +> For long-time users, you may note that COMPOSE_FILE is distinctly missing. Don't worry - all the old configuration behaviors previous supported by merging `yml` files together still work with Dolphin and `devcontainer`. This isn't documented quite yet, but we guarantee it will still work! + +> If you have multiple Magento projects on your system, **please ensure that the COMPOSE_PROJECT_NAME value is unique**, otherwise you will find out that you've accidentally shared data between different projects and you'll be in for a world of pain. + +### Configuring Your Hosts File +Add the following entry to your **host** system's `/etc/hosts` file. + +```bash +127.0.0.1 magento2.test +``` + +If you're using [WSL2, use this instead.](https://github.com/microsoft/WSL/issues/4983) Be sure to do this on the Windows host. +```bash +127.0.0.1 magento2.test +[::1] magento2.test +``` + +### Install the recommended VSCode Workspace extensions and the `devcontainer-cli` +* [Install Recommended Extensions](../../.vscode/extensions.json) +* [Install the devcontainer cli](https://code.visualstudio.com/docs/remote/devcontainer-cli) + +### Start your environment +From your `mage2docker` repo: + +```bash +devcontainer open +``` +### See the Setup Page +Now, you should be able to visit `https://magento2.test` in your browser and see a fresh Luma Magento store with Venia Sample data! diff --git a/docs/stories/existing-project.md b/docs/stories/existing-project.md index 873ab0f..e8a2e7d 100644 --- a/docs/stories/existing-project.md +++ b/docs/stories/existing-project.md @@ -96,6 +96,8 @@ docker-compose exec magento2 bin/magento setup:config:set --cache-backend=redis docker-compose exec magento2 bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=fullpagecache --page-cache-redis-db=0 docker-compose exec magento2 bin/magento setup:config:set --session-save=redis --session-save-redis-host=sessioncache --session-save-redis-db=0 docker-compose exec magento2 bin/magento setup:config:set --amqp-host="message_queue" --amqp-port="5672" --amqp-user="guest" --amqp-password="guest" + +bin/magento deploy:mode:set developer ``` ## Taking the Environment Down diff --git a/docs/stories/reinstalling.md b/docs/stories/reinstalling.md index f98cffb..25f8f46 100644 --- a/docs/stories/reinstalling.md +++ b/docs/stories/reinstalling.md @@ -7,8 +7,10 @@ Sometimes things go wrong and you have to rebuild your local environment from sc ## Delete the docker environment ```bash -docker-compose down -docker volume prune +export $(grep -v '^#' .env | xargs) +docker container stop $(docker container ls -aq --filter name=$COMPOSE_PROJECT_NAME*) +docker container rm $(docker container ls -aq --filter name=$COMPOSE_PROJECT_NAME*) +docker volume rm $(docker volume ls -q --filter name=$COMPOSE_PROJECT_NAME*) ``` ## This time with feeling From 7e66c4279e4f3f2838f42b5da23ede9c5ecd3e2f Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Thu, 4 Aug 2022 14:31:19 -0400 Subject: [PATCH 13/13] ci: use a well-known name in CI --- .github/workflows/startup/configure.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/startup/configure.sh b/.github/workflows/startup/configure.sh index 30a8951..63dc8f2 100755 --- a/.github/workflows/startup/configure.sh +++ b/.github/workflows/startup/configure.sh @@ -3,6 +3,7 @@ set -e MAGENTO_VERSION_2_3='magento/project-community-edition=2.3.*' MAGENTO_VERSION_2_4='magento/project-community-edition=2.4.*' +COMPOSE_PROJECT_NAME='mage2docker'; case "$COMPOSER_PROJECT" in "$MAGENTO_VERSION_2_3") @@ -17,4 +18,6 @@ case "$COMPOSER_PROJECT" in printf "Unknown Magento version" exit 1; ;; -esac \ No newline at end of file +esac + +sed -i -e "s|^[#]*\s*COMPOSE_PROJECT_NAME=.*|COMPOSE_PROJECT_NAME="$COMPOSE_PROJECT_NAME"|" .env \ No newline at end of file