diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..efd437c --- /dev/null +++ b/.env.example @@ -0,0 +1,128 @@ +########################################## +## MAIN SETTINGS ## +########################################## + +# Set the base path were you want to keep Magento source files +# e.g. /var/www/html or ~/src/html +M2D_SOURCE_DIRECTORY='/var/www/html' +# Define a synchronisation type used to sync source directory between host and container +# - 'mutagen' container will use named volume and Mutagen [https://mutagen.io/] will be used to sync files (default) +# - 'sshfs' container will use named volume and SSHFS will be used to mount it to the host +# - 'bind' will binds source directory on host to container (performance on Mac and Windows may be not sufficient) +M2D_SOURCE_DIRECTORY_SYNC_TYPE='mutagen' +# Set your CPU type: +# - 'm1' for Apple M1 CPUs +# - 'intel' for Intel or AMD based CPUs +M2D_CPU_TYPE='m1' +# Set your IDE key for xDebug: +# - 'PHPSTORM' if you are PHP Storm user +# - 'VSCODE' if you are Microsoft Visual Studio Code user +# - '***' you can set any value your IDE requires +M2D_XDEBUG_IDE_KEY='PHPSTORM' +# Provide Composer authorisation: +COMPOSER_AUTH='{"http-basic":{"repo.magento.com":{"username": "","password":""}}}' +# Provide Magento CLI authentication token: +MAGENTO_CLOUD_CLI_TOKEN='' + +########################################## +## TOOLS CONFIGURATION SECTION ## +########################################## + +## MAILCATCHER +# Set to 'yes' to enable Mailcatcher or to 'no' to disable it: +M2D_ENABLE_MAILCATCHER='no' +# Set the port number on which the Mailcatcher web interface will be hosted: +M2D_PORT_FOR_MAILCATCHER=1080 + +## BLACKFIRE +# Set to 'yes' to enable Blackfire or to 'no' to disable it: +M2D_ENABLE_BLACKFIRE='no' + +## SELENIUUM +# Set to 'yes' to enable Selenium or to 'no' to disable it: +M2D_ENABLE_SELENIUM='no' +# Set Selenium version you want to use: +M2D_SELENIUM_VERSION='3.14.0' +# Set port number used by Seleniub HUB: +M2D_PORT_FOR_SELENIUM_HUB='4444' +# Set the port number used by VNC in Selenium container: +M2D_PORT_FOR_SELENIUM_VNC='5900' + + +########################################## +## SERVICES CONFIGURATION SECTION ## +########################################## + +## WEB SERVER +# Set which Web server engine you want to use: +# - 'apache' for Apache [https://www.apache.org/] +M2D_WEB_SERVER_VENDOR='apache' +# Set which PHP version you want to use: +# - PHP versions: 7.3, 7.4, 8.1, 8.2 +M2D_WEB_SERVER_PHP_VERSION='8.1' +# Set the port number used by SSH: +M2D_PORT_FOR_WEB_SERVER_SSH='2222' +# Set the port number used by HTTP: +M2D_PORT_FOR_WEB_SERVER_HTTP='80' +# Set the port number used by HTTPS: +M2D_PORT_FOR_WEB_SERVER_HTTPS='443' + +## DB ENGINE +# Set which DB engine you want to use: +# - 'mariadb' for MariaDB [https://www.elastic.co/] +# - 'mysql' for Opensearch [https://opensearch.org/] +M2D_DB_ENGINE_VENDOR='mariadb' +# Set expected version of the search engine: +# - MariaDB versions: 10, 10.2, 10.3, 10.4, 10.6 +# - MySQL versions: 5, 5.7, 8, 8.0, 8.0-oracle +M2D_DB_ENGINE_VERSION='10' +# Set the port number used by search engine: +M2D_PORT_FOR_DB_ENGINE='3306' + +## SEARCH ENGINE +# Set to 'yes' to enable search engine or to 'no' to disable it: +M2D_ENABLE_SEARCH_ENGINE='yes' +# Set which search engine you want to use: +# - 'elasticsearch' for ElasticSearch [https://www.elastic.co/] +# - 'opensearch' for Opensearch [https://opensearch.org/] +M2D_SEARCH_ENGINE_VENDOR='elasticsearch' +# Set expected version of the search engine: +# - ElasticSearch versions: 6, 7, 7.6, 7.7, 7.9, 7.10, 7.16, 7.17, 8, 8.4 +# - OpenSearch versions: 1, 1.2, 2, 2.5 +M2D_SEARCH_ENGINE_VERSION='7' +# Set the port number used by search engine: +M2D_PORT_FOR_SEARCH_ENGINE='9200' + +## MESSAGE-BROKER +# Set to 'yes' to enable Message Broker or to 'no' to disable it: +M2D_ENABLE_MESSAGE_BROKER='no' +# Set which message broker you want to use: +# - 'rabbitmq' for RabbitMQ [https://www.rabbitmq.com/] +M2D_MESSAGE_BROKER_VENDOR='rabbitmq' +# Set expected version of the message broker: +# - RabbitMQ versions: 3.8, 3.9 +M2D_MESSAGE_BROKER_VERSION='3.8' +# Set the port number used by a broker: +M2D_PORT_FOR_MESSAGE_BROKER='15672' + +## WEB CACHE +# Set to 'yes' to enable Web Cache or to 'no' to disable it +M2D_ENABLE_WEB_CACHE='no' +# Set witch web cache solution to use: +# - 'varnish' for Varnish HTTP Cache [https://varnish-cache.org/] +M2D_WEB_CACHE_VENDOR='varnish' +# Set expected version of the web cache: +# - Varnish versions: 6, 6.0, 6.2, 6.4, 6.5, 7, 7.0, 7.1 +M2D_WEB_CACHE_VERSION='6' +# Set the port number used by web cache: +M2D_PORT_FOR_WEB_CACHE='8080' + +## DB CACHE +# Set to 'yes' to enable DB Cache or to 'no' to disable it +M2D_ENABLE_DB_CACHE='no' +# Set witch db cache solution to use: +# - 'redis' for Redis [https://redis.io/] +M2D_DB_CACHE_VENDOR='redis' +# Set expected version of the db cache: +# - Redis versions: 5, 6, 6.2, 7 +M2D_DB_CACHE_VERSION='6.2' diff --git a/.gitignore b/.gitignore index 4010498..4c49bd7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1 @@ -src/* -!src/index.php - -env/.env -env/etc/composer/auth.json -!env/etc/git/* -!env/etc/git/gitconfig.example -env/etc/git/gitconfig - -env/etc/m2install/.m2install.conf.override -env/docker-compose.override.yml - -.idea -env/etc/apache/* -!env/etc/vhost.conf.example -!env/etc/apache/envvars -!env/etc/apache/000-default.conf -!env/etc/apache/second-level.nip.io.conf - -env/misc/* -!env/misc/xdebug-php.sh -!env/misc/prepare-mtf.sh - -env/etc/host/config.sh.override +.env diff --git a/README.md b/README.md index 66208e8..5e22cf8 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,22 @@ -# Magento2 Docker Environment -An Ideal Magento2 Development Environment OSX Centric. +# Magento2Docker Environment +A near to perfect Magento2 Development Environment OS agnostic, OSX focused. Key features of the project: - Simple Apache PHP container based on original images. - - Ideal to work with multiple projects same time + - Ideal to work with multiple projects same time. - Multi-project setup with clean host names. Based on external nip.io wildcard DNS server. - - Provides real-time file synchronization by Mutagen - - Includes PHPStorm container which can be rendered by X.ORG port for OSX + - Provides real-time file synchronization by Mutagen. + - Includes PHPStorm container which can be rendered by X.ORG port for OSX. - Includes great set of tools with zero configuration like Blackfire, XDebug. - - Includes external services: ElasticSearch 2.x - 6.x, Redis, MailCatcher, RabbitMQ. - - Provides Make tool as a wrapper. Simplify managing containers and support bash completion to hightlight commands. - + - Includes all external services needed by Magento: ElasticSearch, Opensearch, Redis, Varnish, MySQL, MariaDB, MailCatcher, RabbitMQ, other. + - Provides bash CLI tool a wrapper. Simplify managing containers. + - Fully compatible with standard docker-compose commands. + - Intel and Apple M1 CPU support. + - Easily extensible. + - Single docker-compose.yaml file approach with .env file to configure everything. ## Contents - - [Pre-requirements](#pre-requirements) - [Installation](#installation) +- [Supported services and tools](#supported-services-and-tools) - [Usage](#usage) - [Quick Start](#quick-start) - [How to install a magento](#how-install-magento) @@ -30,62 +33,93 @@ Key features of the project: - [Install Docker](https://docs.docker.com/engine/installation/mac/) - [Install Mutagen](https://mutagen.io/documentation/introduction/installation/) - [Install bash completion (optional)](https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion) - + ## Installation You can download archive of this project on [Release Page](https://github.com/yvoronoy/magento2docker/releases). - Clone or Download the repository ```git clone git@github.com:yvoronoy/magento2docker.git``` - - Copy or create `env/etc/composer/auth.json` and put your [Access Keys](http://devdocs.magento.com/guides/v2.0/install-gde/prereq/dev_install.html) - - `cp env/etc/composer/auth.json.example env/etc/composer/auth.json` - - Edit env/etc/composer/auth.json and put your credentials [Access Keys](http://devdocs.magento.com/guides/v2.0/install-gde/prereq/dev_install.html) - - Update your gitconfig if needed - - `cp env/etc/git/gitconfig.example env/etc/git/gitconfig` - - Update and edit Commerce Cloud CLI Token - - `cp env/.env.example env/.env` - - (Optional) Copy your private ssh keys, configs to have access to resources from inside container - - `cp ~/.ssh/id_rsa env/etc/ssh/` - - `cp ~/.ssh/config env/etc/ssh/` + - Go to project folder + - Execute setup creator `./bin/m2d setup init` + - Optional: fine tune all setings by editing `.env` file + +## Supported services and tools +### Web Servers +- Apache with PHP: 7.3, 7.4, 8.0, 8.1, 8.2 + +### DB Engines +- MySQL: 5.7, 8.0, 8.0-oracle, and 5.7 as 5, 8.0.28 as 8 +- MariaDB: 10.2, 10.3, 10.4, 10.6, and 10.4 as 10 + +### Search Engines +- Opensearch: 1.2.4 as 1.2, 1.2.4 as 1, 2.5.0 as 2.5, 2.5.0 as 2 +- Elasticsearch: 6.8.23 as 6, 7.16.3 as 7, 7.6.2 as 7.6, 7.7.1 as 7.7, 7.9.3 as 7.9, 7.10.1 as 7.10, 7.16.3 as 7.16, 7.17.9 as 7.17, 8.4.3 as 8, 8.4.3 as 8.4 + +### DB Cache Engines +- Redis: 6.2, 5.0 as 5, 6.0 as 6, 7.0 as 7 + +### Web Cache Engines +- Varnish: 6.0, 6.2, 6.4, 6.5, 7.0, 7.1, and 7.0 as 7, 6.5 as 6 + +### Tools +- Blackfire: latest +- Mailcatcher: latest +- Selenium: 3.14.0 + ## Usage +To work with Magento2Docker you can use `m2d` CLI command located in `bin` of Magento2Docker project. ### Quick Start -Commands should be executed from _env_ directory. -Run make command to run environment. +With Magento2Docker v3 it is super easy to start or stop containers: +```bash +# Display help +./bin/m2d --help -``` -# Build and mount containers (default: php-7.4) -bin/up +# To start containers: +./bin/m2d up + +# To stop containers: +./bin/m2d stop + +# To stop and remove containers and networks: +./bin/m2d down + +# To enable service e.g. mailcatcher +./bin/m2d enable mailcatcher -# Login on web server container -bin/shell +# To disable service e.g. elasticsearch: +./bin/m2d disable search-engine -# Change php version - - For php-7.3: make up73 - - For php-7.4: make up74 - - For php-8.0: make up80 - - For php-8.1: make up81 +# To edit any .env parameter (e.g. PHP version): +./bin/m2d set M2D_WEB_SERVER_PHP_VERSION 8.1 + +# To display any .env parameter (e.g. search engine type): +./bin.m2d show M2D_SEARCH_ENGINE_VENDOR + +# To start containers after enabling or disabling services or editing parameters: +./bin/m2d up --buld ``` + ### How to install a magento inside container - - Login to container `make web` + - Login to container `./bin/m2d go web` - Create a directory e.g: magento2 - - Inside the magento2 directory run `m2install.sh -s composer -v 2.3.3` + - Inside the magento2 directory run `m2install.sh -s composer -v 2.4.6` - Open browser and go to http://magento2.127.0.0.1.nip.io/ ### How to deploy dumps (backups) inside container - Put dumps to src folder on your host machine - - Login to container `make web` + - Login to container `./bin/m2d go web` - Run `m2install.sh` ## How to link Composer versions -Containers for PHP 7.4, PHP 8.0, and PHP 8.1 has Composer 2 because of Magento supports Composer 2 since 2.4.2 -version. +Containers with PHP 7.x have Composer 1 set as default, containers with PHP 8.x have Composer 2 set as default version. ### Usage: -- Login to your container `bin/shell-root` +- Login to container `./bin/m2d go web` - To use composer as default you have two commands: - - Run command `composer-link.sh 1` to use Composer 1 - - Run command `composer-link.sh 2` to use Composer 2 + - Run command `sudo composer-link.sh 1` to use Composer 1 + - Run command `sudo composer-link.sh 2` to use Composer 2 ## How to Enable xDebug @@ -93,8 +127,8 @@ The container already includes PHP xDebug extension. The xDebug extension is dis it is dramatically decrease performance. ### Usage - - Login to your container `make web` - - Run command `xdebug-php.sh 1` + - Login to your container `./bin/m2d go web` + - Run command `sudo xdebug-php.sh 1` - Run IDE (PHPStorm) and press button _Start Listening for PHPDebug Connection_ @@ -110,13 +144,14 @@ it is dramatically decrease performance. Profiling with Blackfire is on-demand. This means that Blackfire adds no overhead for your end users, which makes it safe to use in production. ### Get your Blackfire credentials -Blackfire provides you a free account "Hack" which allows you to run profiles on your development environment. +Blackfire provides you a free account "Hack" which allows you to run profiles on your development environment. - Create account and login here: https://blackfire.io/login - Install Browser Extension https://blackfire.io/docs/integrations/chrome - Go to the page https://blackfire.io/docs/integrations/docker - Define these environment variables from this page on the host system (OSX) - You can save them permanently by putting them into ~/.bash_profile file - - Recreate containers by using command `make up` + - Enable blackfire container `./bin/m2d enable blackfire` + - Recreate containers by using command `./bin/m2d up --build` ## How to run PHPStorm inside container @@ -130,18 +165,17 @@ Blackfire provides you a free account "Hack" which allows you to run profiles on Run the following command inside env directory ``` -make phpstorm +docker-compose -f docker-compose.phpstorm.yml up -d --build ``` ## Todo List ## Contributing 1. Fork this repository. -2. Create your feature branch: `git checkout -b my-new-feature`. +2. Create your feature branch: `git checkout -b feature/my-cool-feature`. 3. Commit your changes: `git commit -am 'Add some feature'`. -4. Push to the branch: `git push origin my-new-feature`. +4. Push to the branch: `git push origin feature/my-cool-feature`. 5. Submit a pull request. ## Credits Special thanks to @snosov and @tshabatyn who share their ideas and inspired to build this project. - diff --git a/bin/m2d b/bin/m2d new file mode 100755 index 0000000..09bd5b7 --- /dev/null +++ b/bin/m2d @@ -0,0 +1,585 @@ +#!/usr/bin/env bash +# shellcheck shell=bash + +function _m2d_display_help_main () +{ + echo " +Usage: ./bin/m2d COMMAND [OPTIONS] + +Options: + -h, --help Disply help for command + +Commands: + build Build or rebuild containers + disable Disable selected service or tool + down Stop and remove containers and networks + enable Enable selected service or tool + logs View logs from containers + set Sets configuration value + setup Configure project + show Shows configuration value + stop Stops containers + sync Manage data sync from between host an containers + up Create and start containers +" +} + +function _m2d_display_help_set () +{ + echo " +Usage: ./bin/m2d set [OPTIONS] PARAMETER VALUE + +Options: + -h, --help Disply help for command + +Parameters: + php Alias for parameter M2D_WEB_SERVER_PHP_VERSION + [M2D_*] Parameter name. List of possible parameters and their values is in .env.example +" +} + +function _m2d_display_help_show () +{ + echo " +Usage: ./bin/m2d show [OPTIONS] PARAMETER + +Options: + -h, --help Disply help for command + +Parameters: + [M2D_*] Parameter name. List of possible parameters is in .env.example +" +} + +function _m2d_display_help_setup () +{ + echo " +Usage: ./bin/m2d setup [OPTIONS] [COMMAND] [PROJECT_ID] + +Options: + -h, --help Disply help for command + +Commands: + init Starts creator of initial configuration for Web container and .env file + env Starts .env file creator + from-cloud Generates .env file based on provided PROJECT_ID +" +} + +function _m2d_display_help_enable_disable () +{ + echo " +Usage: ./bin/m2d $1 [OPTIONS] COMMAND + +Options: + -h, --help Disply help for command + +Commands: + blackfire ${1^} blackfire container + db-cache ${1^} db-cache container + elastic Alias for 'search-engine ' command + m Alias for 'mailcatcher' command + mailcatcher ${1^} mailcatcher container + message-broker ${1^} message broker container + rabbit Alias for 'message-broker' command + redis Alias for 'db-cache' command + search-engine ${1^} search engine container + selenium ${1^} selenium container + varnish Alias for 'web-cache' command + web-cache ${1^} web-cache container + +After container is $1 it must be rebuild with: \`./bin/m2d build\` or \`./bin/m2d up --build\` +" +} + +function _m2d_display_help_up () +{ + echo " +Usage: ./bin/m2d up [OPTIONS] + +Options: + -h, --help Disply help for command + -b, --build Build images before starting containers. +" +} + +function _m2d_display_help_commad_generic () +{ + echo " +Usage: ./bin/m2d $1 [OPTIONS] + +Options: + -h, --help Disply help for command +" +} + +function _m2d_display_help_go () +{ + echo " +Usage: ./bin/m2d go [OPTIONS] CONTAINER_NAME + +Options: + -h, --help Disply help for command + +Containers: + web Alias for m2d-web container + +Current containers: +" +docker ps --format '{{.Names}}' +} + +function _m2d_display_help_logs () +{ + echo " +Usage: ./bin/m2d logs [OPTIONS] CONTAINER_NAME + +Options: + -h, --help Disply help for command + +Current containers: +" +docker ps --format '{{.Names}}' +} + +function _m2d_display_help_sync () +{ + echo " +Usage: ./bin/m2d sync [OPTIONS] ACTION + +Options: + -h, --help Disply help for command + +Actions: + start Starts synchronisation if applicable + pause Pause synchronisation if applicable + stop Stops synchronization if applicable + status Display synchronization status if applicable + restart Restart synchronisation if applicable +" +} + +function _m2d_init_source_folder () +{ + local env_file="$1" + local current_folder=$(_m2d_env_get_parameter "$env_file" M2D_SOURCE_DIRECTORY) + local new_folder + + read -p "Set the path where you want to keep Magento source files. Press enter to keep current '$current_folder': " new_folder + + if [[ -z "$new_folder" ]]; then + new_folder="$current_folder" + fi + + new_folder=$(eval echo "$new_folder") + + if [[ ! -d "$new_folder" ]]; then + local confirm + read -p "Path '$new_folder' doesn't exist. Create it? [y/n]: " confirm + [[ $confirm == 'y' ]] && mkdir -p "$new_folder" + fi + + echo "$new_folder" +} + +function _m2d_init_env() +{ + local env_file="$1" + local current_value value confirm + + if [[ -f "$env_file" ]]; then + read -p 'You already have .env file. Do you want to recreate it? [y/n]: ' confirm + if [[ $confirm == 'y' ]]; then + cp "$env_file.example" "$env_file" + fi + else + cp "$env_file.example" "$env_file" + fi + + read -p 'Do you want to configure main Magento2Docker settings? [y/n]: ' confirm + if [[ $confirm != 'y' ]]; then + echo "Magento2Docker will use settings from this file: '$env_file'" + echo 'Please verify them before further usage!' + return 0 + fi + + while [[ ! -d "$value" ]]; + do + value=$(_m2d_init_source_folder "$env_file") + done + _m2d_env_set_parameter "$env_file" M2D_SOURCE_DIRECTORY "$value" + + read -p 'Are you on Apple M1 chip? [y/n]: ' confirm + if [[ $confirm == 'y' ]]; then + _m2d_env_set_parameter "$env_file" M2D_CPU_TYPE m1 + else + _m2d_env_set_parameter "$env_file" M2D_CPU_TYPE intel + fi + + value=$(_m2d_env_get_parameter "$env_file" M2D_XDEBUG_IDE_KEY) + read -p "Provide IDE key for xDebug (e.g.: PHPSTORM, VSCODE). Press enter to keep current '$value': " value + if [[ -n $value ]]; then + _m2d_env_set_parameter "$env_file" M2D_XDEBUG_IDE_KEY "$value" + fi + + value=$(_m2d_env_get_parameter "$env_file" MAGENTO_CLOUD_CLI_TOKEN) + read -p "Provide Magento Cloud CLI authentication token. Press enter to keep current '$value': " value + if [[ -n $value ]]; then + _m2d_env_set_parameter "$env_file" MAGENTO_CLOUD_CLI_TOKEN "$value" + fi +} + +function _m2d_env_set_parameter () +{ + local env_file="$1" + local parameter="$2" + local value="$3" + + if [[ ! -f "$env_file" ]]; then + echo "Env file '$env_file' doesn't exist! Initialize it by executing \`./bin/m2d setup env\`" + return 1 + fi + + sed -i.back "s|^\\(${parameter}=\\).*|\\1'$value'|" "$env_file" +} + +function _m2d_env_get_parameter () +{ + local env_file="$1" + local parameter="$2" + local default="${3:-}" + + if [[ ! -f "$env_file" ]]; then + echo "Env file '$env_file' doesn't exist! Initialize it by executing \`./bin/m2d setup env\`" + return 1 + fi + + local value=$(grep "^$parameter=" "$env_file" | cut -d '=' -f 2 | tr -d "'") + value="${value:=$default}" + + echo "$value" +} + +function _m2d_exec_container () +{ + local container_name="$1" + local allowed=$(docker ps --format '{{.Names}}' | grep "$container_name") + local user_name="${2:-root}" + + if [[ -n "$allowed" ]]; then + docker exec -it --user "$user_name" "$container_name" /bin/bash + else + echo "Sorry, container '$container_name' does not exists!" + fi +} + +function _m2d_logs_container () +{ + local container_name="$1" + local allowed=$(docker ps --format '{{.Names}}' | grep "$container_name") + + if [[ -n "$allowed" ]]; then + docker logs -f "$container_name" + else + echo "Sorry, container '$container_name' does not exists!" + fi +} + +function _m2d_sync () +{ + local action="$1" + local env_file="$2" + local sync_type=$(_m2d_env_get_parameter "$env_file" M2D_SOURCE_DIRECTORY_SYNC_TYPE) + local sync_dir=$(_m2d_env_get_parameter "$env_file" M2D_SOURCE_DIRECTORY) + local server_vendor=$(_m2d_env_get_parameter "$env_file" M2D_WEB_SERVER_VENDOR) + local ssh_port=$(_m2d_env_get_parameter "$env_file" M2D_PORT_FOR_WEB_SERVER_SSH) + local project_path="$3" + + case $sync_type in + 'bind') + echo "Nothing to do for '$action' in '$sync_type' sync type" + ;; + 'sshfs') + case $action in + 'start') + local identity_file="$project_path/services/web-servers/$server_vendor/etc/ssh/magento2docker" + chmod 400 "$identity_file" + sshfs magento@127.0.0.1:/var/www/html "$sync_dir" \ + -o reconnect \ + -o StrictHostKeyChecking=no \ + -o follow_symlinks \ + -o IdentityFile="$identity_file" \ + -o port="$ssh_port" \ + -o compression=no + ;; + 'stop'|'pause') + umount -f "$sync_dir" + ;; + *) + echo "Nothing to do for '$action' in '$sync_type' sync type" + ;; + esac + ;; + 'mutagen') + case $action in + 'start') + if [[ -n $(mutagen sync list | grep m2d-sync) ]]; then + mutagen sync resume m2d-sync + else + mutagen sync create --name=magento2web \ + --default-group-beta=magento \ + --default-owner-beta=magento \ + --sync-mode=two-way-resolved \ + --default-file-mode=0664 \ + --default-directory-mode=0755 \ + --ignore=/.idea \ + --ignore=/.magento \ + --ignore=/.docker \ + --ignore=/.github \ + --ignore-vcs \ + --ignore=/**/var/cache \ + --ignore=/**/var/page_cache \ + --ignore=/**/var/session \ + --ignore=/**/var/log \ + --ignore=/**/.DS_Store \ + --symlink-mode=posix-raw \ + "$sync_dir" \ + docker://magento@m2d-web/var/www/html/ + fi + ;; + 'pause') + mutagen sync pause m2d-sync + ;; + 'stop') + mutagen sync terminate m2d-sync + ;; + 'status') + mutagen sync monitor m2d-sync + ;; + 'restart') + _m2d_sync stop "$env_file" + _m2d_sync start "$env_file" + ;; + *) + echo "Nothing to do for '$action' in '$sync_type' sync type" + ;; + esac + ;; + *) + echo "Sync type '$sync_type' is not supported!" + ;; + esac +} + + +M2D_SCRIPT_DIRECTORY=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) +M2D_PROJECT_PATH="$(realpath $M2D_SCRIPT_DIRECTORY/../)" +M2D_ENV_FILE="$(realpath $M2D_PROJECT_PATH/.env)" + +case $1 in + 'set') + case $2 in + '-h'|'--help') + _m2d_display_help_set + ;; + 'php') + _m2d_env_set_parameter "$M2D_ENV_FILE" "M2D_WEB_SERVER_PHP_VERSION" "$3" + ;; + 'es') + _m2d_env_set_parameter "$M2D_ENV_FILE" "M2D_SEARCH_ENGINE_VENDOR" elasticsearch + _m2d_env_set_parameter "$M2D_ENV_FILE" "M2D_SEARCH_ENGINE_VERSION" "$3" + ;; + *) + _m2d_env_set_parameter "$M2D_ENV_FILE" "$2" "$3" + ;; + esac + ;; + + 'show') + case $2 in + '-h'|'--help') + _m2d_display_help_show + ;; + *) + _m2d_env_get_parameter "$M2D_ENV_FILE" "$2" + ;; + esac + ;; + + 'setup') + case $2 in + 'init') + _m2d_init_env "$M2D_ENV_FILE" + source "$M2D_SCRIPT_DIRECTORY/../services/web-servers/apache/bin/install.sh" + ;; + 'env') + _m2d_init_env "$M2D_ENV_FILE" + ;; + 'from-cloud') + echo 'Not yet implemented!' + ;; + *) + _m2d_display_help_setup + ;; + esac + ;; + + 'enable') + case $2 in + '-h'|'--help') + _m2d_display_help_enable_disable "enable" + ;; + 'blackfire') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_BLACKFIRE yes + ;; + 'mailcatcher'|'m') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_MAILCATCHER yes + ;; + 'selenium') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_SELENIUM yes + ;; + 'web-cache'|'varnish') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_WEB_CACHE yes + ;; + 'db-cache'|'redis') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_DB_CACHE yes + ;; + 'message-broker'|'rabbit') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_MESSAGE_BROKER yes + ;; + 'search-engine'|'elastic') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_SEARCH_ENGINE yes + ;; + esac + ;; + + 'disable') + case $2 in + '-h'|'--help') + _m2d_display_help_enable_disable "disable" + ;; + 'blackfire') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_BLACKFIRE no + ;; + 'mailcatcher'|'m') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_MAILCATCHER no + ;; + 'selenium') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_SELENIUM no + ;; + 'web-cache'|'varnish') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_WEB_CACHE no + ;; + 'db-cache'|'redis') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_DB_CACHE no + ;; + 'message-broker'|'rabbit') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_MESSAGE_BROKER no + ;; + 'search-engine'|'elastic') + _m2d_env_set_parameter "$M2D_ENV_FILE" M2D_ENABLE_SEARCH_ENGINE no + ;; + esac + ;; + + 'up') + case $2 in + '-h'|'--help') + _m2d_display_help_up + ;; + '-b'|'--build') + if [[ 'bind' == $(_m2d_env_get_parameter "$M2D_ENV_FILE" M2D_SOURCE_DIRECTORY_SYNC_TYPE) ]]; then + docker-compose --project-directory "$M2D_PROJECT_PATH" \ + -f "$M2D_PROJECT_PATH/docker-compose.yaml" \ + -f "$M2D_PROJECT_PATH/docker-compose.bind.yaml" \ + up -d --build + else + docker-compose --project-directory "$M2D_PROJECT_PATH" up -d --build + fi + _m2d_sync start "$M2D_ENV_FILE" "$M2D_PROJECT_PATH" + ;; + *) + docker-compose --project-directory "$M2D_PROJECT_PATH" up -d + _m2d_sync start "$M2D_ENV_FILE" "$M2D_PROJECT_PATH" + ;; + esac + ;; + 'down') + case $2 in + '-h'|'--help') + _m2d_display_help_commad_generic "down" + ;; + *) + docker-compose --project-directory "$M2D_PROJECT_PATH" down + _m2d_sync stop "$M2D_ENV_FILE" "$M2D_PROJECT_PATH" + ;; + esac + ;; + 'stop') + case $2 in + '-h'|'--help') + _m2d_display_help_commad_generic "stop" + ;; + *) + docker-compose --project-directory "$M2D_PROJECT_PATH" stop + _m2d_sync pause "$M2D_ENV_FILE" "$M2D_PROJECT_PATH" + ;; + esac + ;; + 'build') + case $2 in + '-h'|'--help') + _m2d_display_help_commad_generic "build" + ;; + *) + if [[ 'bind' == $(_m2d_env_get_parameter "$M2D_ENV_FILE" M2D_SOURCE_DIRECTORY_SYNC_TYPE) ]]; then + docker-compose --project-directory "$M2D_PROJECT_PATH" \ + -f "$M2D_PROJECT_PATH/docker-compose.yaml" \ + -f "$M2D_PROJECT_PATH/docker-compose.bind.yaml" \ + build + else + docker-compose --project-directory "$M2D_PROJECT_PATH" build + fi + ;; + esac + ;; + + 'go') + case $2 in + '-h'|'--help') + _m2d_display_help_go + ;; + 'web') + docker exec -it --env COLUMNS=`tput cols` --env LINES=`tput lines` --user magento m2d-web bash + ;; + *) + _m2d_exec_container "$2" "$3" + ;; + esac + ;; + + 'logs') + case $2 in + '-h'|'--help') + _m2d_display_help_logs + ;; + *) + _m2d_logs_container "$2" + ;; + esac + ;; + + 'sync') + case $2 in + '-h'|'--help') + _m2d_display_help_sync + ;; + *) + _m2d_sync "$2" "$M2D_ENV_FILE" "$M2D_PROJECT_PATH" + ;; + esac + ;; + *) + _m2d_display_help_main + ;; +esac diff --git a/docker-compose.bind.yml b/docker-compose.bind.yml new file mode 100644 index 0000000..25b89fa --- /dev/null +++ b/docker-compose.bind.yml @@ -0,0 +1,6 @@ +version: '3' + +services: + web: + volumes: + - ${M2D_SOURCE_DIRECTORY}:/var/www/html diff --git a/env/docker-compose.phpstorm.yml b/docker-compose.phpstorm.yml similarity index 78% rename from env/docker-compose.phpstorm.yml rename to docker-compose.phpstorm.yml index e34a511..41c0072 100644 --- a/env/docker-compose.phpstorm.yml +++ b/docker-compose.phpstorm.yml @@ -4,8 +4,8 @@ services: phpstorm: container_name: phpstorm build: - context: ./ - dockerfile: additional/phpstorm/Dockerfile + context: . + dockerfile: services/phpstorm/Dockerfile ports: - "9000:9000" volumes: @@ -14,10 +14,12 @@ services: - src-volume:/var/www/html environment: - DISPLAY=host.docker.internal:0 + networks: default: - external: - name: env_default + name: m2d-network + external: true + volumes: src-volume: phpstorm-config: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..992c117 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,158 @@ +version: '3' + +services: + web: + hostname: magento2.test + container_name: m2d-web + restart: unless-stopped + build: + context: . + dockerfile: services/web-servers/${M2D_WEB_SERVER_VENDOR:-apache}/Dockerfile + target: web_server + args: + - M2D_WEB_SERVER_PHP_VERSION=${M2D_WEB_SERVER_PHP_VERSION:-8.1} + - M2D_ENABLE_BLACKFIRE=${M2D_ENABLE_BLACKFIRE:-no} + - M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} + environment: + - BLACKFIRE_CLIENT_ID + - BLACKFIRE_CLIENT_TOKEN + - MAGENTO_CLOUD_CLI_TOKEN + - COMPOSER_AUTH + ports: + - "${M2D_PORT_FOR_WEB_SERVER_HTTP:-80}:80" + - "${M2D_PORT_FOR_WEB_SERVER_HTTPS:-443}:443" + - "${M2D_PORT_FOR_WEB_SERVER_SSH:-2222}:22" + volumes: + - src-volume:/var/www/html + - src-composer-cache-volume:/root/.composer/cache + - home-volume:/home + - root-volume:/root + cap_add: + - "SYS_PTRACE" + + db: + build: + context: . + dockerfile: services/db-engines/Dockerfile + target: m2d_db_engine + args: + - M2D_DB_ENGINE_VENDOR=${M2D_DB_ENGINE_VENDOR:-mariadb} + - M2D_DB_ENGINE_VERSION=${M2D_DB_ENGINE_VERSION:-10} + container_name: m2d-db + restart: unless-stopped + environment: + MYSQL_DATABASE: magento + MYSQL_ALLOW_EMPTY_PASSWORD: 1 + MYSQL_USER: magento + MYSQL_PASSWORD: magento + ports: + - "${M2D_PORT_FOR_DB_ENGINE:-3306}:3306" + volumes: + - db-volume:/var/lib/mysql + + search_engine: + build: + context: . + dockerfile: services/search-engines/Dockerfile + target: m2d_search_engine + args: + - M2D_ENABLE_SEARCH_ENGINE=${M2D_ENABLE_SEARCH_ENGINE:-yes} + - M2D_SEARCH_ENGINE_VENDOR=${M2D_SEARCH_ENGINE_VENDOR:-elasticsearch} + - M2D_SEARCH_ENGINE_VERSION=${M2D_SEARCH_ENGINE_VERSION:-7} + container_name: m2d-searchengine + environment: + - "ES_JAVA_OPTS=-Xms128m -Xmx1g" + - "OPENSEARCH_JAVA_OPTS=-Xms128m -Xmx1g" + ports: + - "${M2D_PORT_FOR_SEARCH_ENGINE:-9200}:9200" + + message_broker: + build: + context: . + dockerfile: services/message-brokers/Dockerfile + target: m2d_message_broker + args: + - M2D_ENABLE_MESSAGE_BROKER=${M2D_ENABLE_MESSAGE_BROKER:-no} + - M2D_MESSAGE_BROKER_VENDOR=${M2D_MESSAGE_BROKER_VENDOR:-rabbitmq} + - M2D_MESSAGE_BROKER_VERSION=${M2D_MESSAGE_BROKER_VERSION:-3.8} + container_name: m2d-messagebroker + restart: unless-stopped + ports: + - "${M2D_PORT_FOR_MESSAGE_BROKER:-15672}:15672" + + web_cache: + build: + context: . + dockerfile: services/web-cache/Dockerfile + target: m2d_web_cache + args: + - M2D_ENABLE_WEB_CACHE=${M2D_ENABLE_WEB_CACHE:-no} + - M2D_WEB_CACHE_VENDOR=${M2D_WEB_CACHE_VENDOR:-varnish} + - M2D_WEB_CACHE_VERSION=${M2D_WEB_CACHE_VERSION:-6} + container_name: m2d-webcache + restart: unless-stopped + ports: + - "${M2D_PORT_FOR_WEB_CACHE:-8080}:8080" + + db_cache: + build: + context: . + dockerfile: services/db-cache/Dockerfile + target: m2d_db_cache + args: + - M2D_ENABLE_DB_CACHE=${M2D_ENABLE_DB_CACHE:-no} + - M2D_DB_CACHE_VENDOR=${M2D_DB_CACHE_VENDOR:-redis} + - M2D_DB_CACHE_VERSION=${M2D_DB_CACHE_VERSION:-6.0} + container_name: m2d-dbcache + restart: unless-stopped + + mailcatcher: + build: + context: . + dockerfile: tools/mailcatcher/Dockerfile + target: m2d_mailcatcher + args: + - M2D_ENABLE_MAILCATCHER=${M2D_ENABLE_MAILCATCHER:-no} + container_name: m2d-mailcatcher + ports: + - "${M2D_PORT_FOR_MAILCATCHER:-1080}:1080" + + blackfire: + build: + context: . + dockerfile: tools/blackfire/Dockerfile + target: m2d_blackfire + args: + - M2D_ENABLE_BLACKFIRE=${M2D_ENABLE_BLACKFIRE:-no} + container_name: m2d-blackfire + environment: + - BLACKFIRE_SERVER_ID + - BLACKFIRE_SERVER_TOKEN + + selenium: + build: + context: . + dockerfile: tools/selenium/Dockerfile + target: m2d_selenium + args: + - M2D_CPU_TYPE=${M2D_CPU_TYPE:-m1} + - M2D_ENABLE_SELENIUM=${M2D_ENABLE_SELENIUM:-no} + - M2D_SELENIUM_VERSION=${M2D_SELENIUM_VERSION:-'3.14.0'} + container_name: m2d-selenium + volumes: + - /dev/shm:/dev/shm + ports: + - "${M2D_PORT_FOR_SELENIUM_HUB:-4444}:4444" + - "${M2D_PORT_FOR_SELENIUM_VNC:-5900}:5900" + shm_size: '2gb' + +networks: + default: + name: m2d-network + +volumes: + home-volume: + root-volume: + src-volume: + db-volume: + src-composer-cache-volume: diff --git a/env/.env.example b/env/.env.example deleted file mode 100644 index 06e77b1..0000000 --- a/env/.env.example +++ /dev/null @@ -1,4 +0,0 @@ -MAGENTO_CLOUD_CLI_TOKEN= -COMPOSER_AUTH={"http-basic":{"repo.magento.com":{"username":"","password":""}}} -M2D_XDEBUG_IDE_KEY=PHPSTORM -M2D_OPENSEARCH_MAX_HEAP_SIZE=512m diff --git a/env/Dockerfile b/env/Dockerfile deleted file mode 100644 index a8f1970..0000000 --- a/env/Dockerfile +++ /dev/null @@ -1,174 +0,0 @@ -#PHP IMAGE -FROM php:7.4-apache-bullseye - -#SETTING UP THE SYSTEM -RUN apt-get update \ - && apt-get install -y \ - apt-utils \ - wget \ - libwebp-dev \ - libxpm-dev \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libxslt-dev \ - libicu-dev \ - mariadb-client \ - pv \ - vim \ - nano \ - bash-completion \ - openssh-server \ - ssl-cert \ - msmtp \ - sudo \ - dnsutils \ - iputils-ping \ - iputils-tracepath \ - host \ - strace \ - telnet \ - unzip \ - gnupg \ - gcc \ - lsof \ - libsodium-dev \ - libzip-dev \ - parallel \ - && apt-get update \ - && apt-get clean all - -#CREATE USER -ENV _USER=magento -ENV _HOME_DIRECTORY=/home/${_USER} -RUN useradd -m ${_USER} && echo "${_USER}:${_USER}" | chpasswd && chsh ${_USER} -s /bin/bash && adduser ${_USER} sudo - -#PHP EXTENSIONS -RUN docker-php-ext-install -j$(nproc) iconv soap sockets \ - && docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \ - && docker-php-ext-install -j$(nproc) gd bcmath pdo_mysql xsl intl zip \ - && pecl install libsodium-2.0.22 - -#GIT -RUN apt-get update \ - && apt-get install -y git \ - && apt-get clean all - -#NODEJS -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \ - && apt-get install -y nodejs - -#BLACKFIRE -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/linux/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 \ - && mkdir -p /tmp/blackfire \ - && curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire \ - && mv /tmp/blackfire/blackfire /usr/bin/blackfire \ - && rm -Rf /tmp/blackfire - -#COMPOSER -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer1 --1\ - && apt -qy install $PHPIZE_DEPS && mkdir /${_HOME_DIRECTORY}/.composer - -#COMPOSER 2 (additional) -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer2 --2 - -#COMPOSER link (1 is default for PHP 7.4) -RUN ln -s /usr/local/bin/composer1 /usr/local/bin/composer - -#XDEBUG -ARG M2D_XDEBUG_IDE_KEY=PHPSTORM -ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} -RUN pecl install xdebug-2.9.0 \ - && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh -COPY ./misc/prepare-mtf.sh /usr/local/bin/prepare-mtf.sh -COPY ./misc/composer-link.sh /usr/local/bin/composer-link.sh - -#CODESNIFFER -RUN pear install PHP_CodeSniffer \ - && mkdir /usr/local/magento-ecg-code-sniffer \ - && cd /usr/local/magento-ecg-code-sniffer/ && composer require magento-ecg/coding-standard \ - && phpcs --config-set installed_paths /usr/local/magento-ecg-code-sniffer/vendor/magento-ecg/coding-standard - -#SENDMAIL -RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/mailcatcher.ini \ - && echo "memory_limit=4G" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "max_input_vars=10000" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "account default" >> /etc/msmtprc \ - && echo "host mailcatcher" >> /etc/msmtprc \ - && echo "port 1025" >> /etc/msmtprc \ - && echo "auto_from on" >> /etc/msmtprc - -#SSH -COPY ./etc/ssh ${_HOME_DIRECTORY}/.ssh -ADD ./etc/ssh/magento2docker.pub ${_HOME_DIRECTORY}/.ssh/authorized_keys -RUN chmod -R 700 ${_HOME_DIRECTORY}/.ssh \ - && echo " ServerAliveInterval 30" >> /etc/ssh/ssh_config \ - && echo " TCPKeepAlive yes" >> /etc/ssh/ssh_config -COPY ./etc/ssh /root/.ssh -ADD ./etc/ssh/magento2docker.pub /root/.ssh/authorized_keys -RUN chmod -R 700 /root/.ssh \ - && echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc" >> /etc/ssh/sshd_config \ - && touch /root/.ssh/known_hosts \ - && ssh-keygen -F github.com || ssh-keyscan github.com >> /root/.ssh/known_hosts - -#APACHE -RUN a2enmod ssl \ - && a2ensite default-ssl.conf \ - && a2enmod vhost_alias \ - && a2enmod proxy \ - && a2enmod rewrite \ - && chown -R ${_USER}:${_USER} /var/www/html -RUN chown -R ${_USER}:${_USER} ${_HOME_DIRECTORY} - -#BASH COMPLETION -USER magento -RUN echo "source /etc/bash_completion" >> ${_HOME_DIRECTORY}/.bashrc - -#MAGENTO CLI -RUN curl -sS https://accounts.magento.cloud/cli/installer | php -USER root - -#TUNE ENVIRONMENT -RUN echo "Defaults timestamp_timeout=-1" >> /etc/sudoers - -#FLAG TO NOT CACHE ANYTHING FROM THIS POINT, details: https://github.com/docker/docker/issues/1996#issuecomment-185872769 -ARG CACHEBUST=1 - -#CUSTOM CONFIGURATIONS -COPY ./etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig -COPY ./etc/composer/auth.json /${_HOME_DIRECTORY}/.composer/auth.json -COPY ./misc/* /usr/local/bin/ -COPY ./etc/apache/envvars /etc/apache2/envvars -COPY ./etc/apache /etc/apache2/sites-enabled/ -COPY ./etc/fixtures /etc/fixtures -COPY ./etc/m2install/.m2install.conf* ${_HOME_DIRECTORY}/ - -#MAGENTO TOOLS -RUN curl -o /usr/local/bin/m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh \ - && curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion \ - && curl -o /usr/local/bin/n98-magerun2 https://files.magerun.net/n98-magerun2.phar \ - && curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash \ - && curl -o /usr/local/bin/m2-convert-for-composer https://raw.githubusercontent.com/isitnikov/m2-convert-patch-for-composer-install/master/convert-for-composer.php \ - && curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion-enterprise \ - && curl -L -o /tmp/teleport.tar.gz https://github.com/gravitational/teleport/releases/download/v1.3.2/teleport-v1.3.2-linux-amd64-bin.tar.gz \ - && tar -xf /tmp/teleport.tar.gz -C /tmp/ \ - && make -C /tmp/teleport/ \ - && git ls-remote git@github.com:magento-sparta/ee-support-tools.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/ee-support-tools.git /usr/local/src/ee-support-tools; else echo; fi \ - && if [ -d /usr/local/src/ee-support-tools ]; then ln -s /usr/local/src/ee-support-tools/cloud-teleport/cloud-teleport /usr/local/bin/cloud-teleport; else echo; fi - -RUN chmod +x /usr/local/bin/* - -CMD service ssh start; apache2-foreground diff --git a/env/Makefile b/env/Makefile deleted file mode 100644 index 877b376..0000000 --- a/env/Makefile +++ /dev/null @@ -1,176 +0,0 @@ -.PHONY: dev prod down stop build mount umount clean web db magento-console phpstorm -FS_MOUNT_TYPE:=$(shell bash etc/host/config.sh FS_MOUNT_TYPE) -ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -SRC_DIR:=$(shell bash etc/host/config.sh SOURCE_DIRECTORY) - -mutagenSession = $(shell mutagen sync list | grep 'magento2web') - -up: - $(info "=====$(shell cat Dockerfile | grep 'FROM')=====") - docker-compose up -d -down: - docker-compose down -stop: - docker-compose stop -build: - docker-compose build --build-arg CACHEBUST=`date +%s` -up73: php73 build up -up74: php74 build up -up80: php80 build up -up81: php81 build up -php73: - $(info ""=====Buildng container with php 7.3"=====") - $(shell yes | cp etc/php/7.3/Dockerfile .) -php74: - $(info ""=====Buildng container with php 7.4"=====") - $(shell yes | cp etc/php/7.4/Dockerfile .) -php80: - $(info ""=====Buildng container with php 8.0"=====") - $(shell yes | cp etc/php/8.0/Dockerfile .) -php81: - $(info ""=====Buildng container with php 8.1"=====") - $(shell yes | cp etc/php/8.1/Dockerfile .) -logs: - docker logs -f magento2web -logs-db: - docker logs -f magento2db -add-host: - echo "127.0.0.1 $(host)" | sudo tee -a /etc/hosts - cp etc/apache/vhost.conf.example etc/apache/$(host).conf - cat etc/apache/$(host).conf | sed "s/ServerName example.com/ServerName $(host)/" > etc/apache/$(host).conf.tmp - mv etc/apache/$(host).conf.tmp etc/apache/$(host).conf - cat etc/apache/$(host).conf | sed "s/\/var\/www\/html\/example/\/var\/www\/html\/$(host)/" > etc/apache/$(host).conf.tmp - mv etc/apache/$(host).conf.tmp etc/apache/$(host).conf - docker-compose build - docker-compose up -d - docker exec -it --user magento magento2web mkdir -p /var/www/html/$(host) - docker exec -i --user magento magento2web sh -c "cat ~/.m2install.conf | sed 's/HTTP_HOST=.*/HTTP_HOST=http:\/\/$(host)\//g' | tee /var/www/html/$(host)/.m2install.conf 1>/dev/null" - docker exec -i --user magento magento2web sh -c "sed -i 's/BASE_PATH=.*/BASE_PATH=/g' /var/www/html/$(host)/.m2install.conf" -remove-host: - cat /etc/hosts | sed 's/.*$(host)//g' > /tmp/hosts.tmp - sudo mv /tmp/hosts.tmp /etc/hosts - rm etc/apache/$(host).conf - docker-compose build - docker-compose up -d - docker exec -i --user magento magento2web sh -c "rm /var/www/html/$(host)/.m2install.conf" - -dev: up mount -dev-stop: umount stop -all: up elastic7 mailcatcher - -phpstorm: - xhost + 127.0.0.1 - docker-compose -f docker-compose.phpstorm.yml build - docker-compose -f docker-compose.yml -f docker-compose.phpstorm.yml up -d -mount-sshfs: - chmod 400 $(ROOT_DIR)/etc/ssh/magento2docker - sshfs magento@127.0.0.1:/var/www/html $(SRC_DIR) -o reconnect -o StrictHostKeyChecking=no -o follow_symlinks -o IdentityFile=$(ROOT_DIR)/etc/ssh/magento2docker -o port=2222 -o compression=no -umount-sshfs: - umount -f $(SRC_DIR) -mount-mutagen: -ifeq ($(mutagenSession),) - mutagen sync create --name=magento2web \ - --default-group-beta=magento \ - --default-owner-beta=magento \ - --sync-mode=two-way-resolved \ - --default-file-mode=0664 \ - --default-directory-mode=0755 \ - --ignore=/.idea \ - --ignore=/.magento \ - --ignore=/.docker \ - --ignore=/.github \ - --ignore-vcs \ - --ignore=/**/var/cache \ - --ignore=/**/var/page_cache \ - --ignore=/**/var/session \ - --ignore=/**/var/log \ - --ignore=/**/.DS_Store \ - --symlink-mode=posix-raw \ - $(SRC_DIR) \ - docker://magento@magento2web/var/www/html/ -else - @echo "Mutagen magento2web session exits, resuming" - mutagen sync resume magento2web -endif -umount-mutagen: - mutagen sync pause magento2web -mount: -ifeq "$(FS_MOUNT_TYPE)" "sshfs" - make mount-sshfs -else - make mount-mutagen -endif -umount: -ifeq "$(FS_MOUNT_TYPE)" "sshfs" - make umount-sshfs -else - make umount-mutagen -endif -clean: - docker stop `docker ps -a -q`; docker rm `docker ps -a -q` - -web: - docker exec -it --env COLUMNS=`tput cols` --env LINES=`tput lines` --user magento magento2web bash -db: - docker exec -it magento2db bash -magento-console: - docker exec -it magento2web n98-magerun2 dev:console - -#Additional Containers -elastic6: - cd additional/elasticsearch6 && docker-compose up -d && cd - - # Web interface: - # http://127.0.0.1:9206 -logs-elastic6: - docker logs -f magento2elastic6 -elastic6-stop: - cd additional/elasticsearch6 && docker-compose stop && cd - -elastic7: - cd additional/elasticsearch7 && docker-compose up -d && cd - - # Web interface: - # http://127.0.0.1:9207 -logs-elastic7: - docker logs -f magento2elastic7 -elastic7-stop: - cd additional/elasticsearch7 && docker-compose stop && cd - -opensearch: - cd additional/opensearch && docker-compose up -d && cd - - # Web interface: - # http://127.0.0.1:9200 -logs-opensearch: - docker logs -f magento2opensearch -opensearch-stop: - cd additional/opensearch && docker-compose stop && cd - -selenium: - cd additional/selenium && docker-compose up -d && cd - - # VNC open vnc://:secret@127.0.0.1:5900 -mailcatcher: - cd additional/mailcatcher && docker-compose up -d && cd - - # Management Console: - # http://127.0.0.1:1080/ -mailcatcher-stop: - cd additional/mailcatcher && docker-compose stop && cd - -rabbitmq: - cd additional/rabbitmq && docker-compose up -d && cd - - # Management Console: - # http://localhost:15672 - # guest:guest -rabbitmq-stop: - cd additional/rabbitmq && docker-compose stop && cd - -redis: - cd additional/redis && docker-compose up -d && cd - -redis-cli: - docker exec -it magento2redis redis-cli -redis-stop: - cd additional/redis && docker-compose stop && cd - -varnish: - cd additional/varnish && docker-compose up -d && cd - - # Update port to 8080 for Magento Base URL configuration -varnish-cli: - docker exec -it magento2varnish varnishadm -varnish-stop: - cd additional/varnish && docker-compose stop && cd - -varnish-logs: - docker logs -f magento2varnish - -# vim: ts=4 sw=4 sts=4 sr noet diff --git a/env/additional/elasticsearch6/Dockerfile b/env/additional/elasticsearch6/Dockerfile deleted file mode 100644 index 44a8b2a..0000000 --- a/env/additional/elasticsearch6/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.elastic.co/guide/en/elasticsearch/reference/6.5/docker.html#docker -FROM docker.elastic.co/elasticsearch/elasticsearch:6.5.4 -COPY --chown=elasticsearch:elasticsearch config/elasticsearch.yml /usr/share/elasticsearch/config/ diff --git a/env/additional/elasticsearch6/docker-compose.yml b/env/additional/elasticsearch6/docker-compose.yml deleted file mode 100644 index ad12c7b..0000000 --- a/env/additional/elasticsearch6/docker-compose.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: '2' - -services: - elasticsearch: - container_name: magento2elastic6 - environment: - - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - build: . - ports: - - "9206:9206" -networks: - default: - external: - name: env_default diff --git a/env/additional/elasticsearch7/Dockerfile b/env/additional/elasticsearch7/Dockerfile deleted file mode 100644 index 93544ee..0000000 --- a/env/additional/elasticsearch7/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.elastic.co/guide/en/elasticsearch/reference/6.5/docker.html#docker -FROM docker.elastic.co/elasticsearch/elasticsearch:7.16.3 -COPY --chown=elasticsearch:elasticsearch config/elasticsearch.yml /usr/share/elasticsearch/config/ diff --git a/env/additional/elasticsearch7/config/elasticsearch.yml b/env/additional/elasticsearch7/config/elasticsearch.yml deleted file mode 100644 index bacd16a..0000000 --- a/env/additional/elasticsearch7/config/elasticsearch.yml +++ /dev/null @@ -1,8 +0,0 @@ -http.host: 0.0.0.0 -http.port: 9207 - -indices.query.bool.max_clause_count: 10240 - -# Uncomment the following lines for a production cluster deployment -#transport.host: 0.0.0.0 -#discovery.zen.minimum_master_nodes: 1 diff --git a/env/additional/elasticsearch7/docker-compose.yml b/env/additional/elasticsearch7/docker-compose.yml deleted file mode 100644 index 5a687f0..0000000 --- a/env/additional/elasticsearch7/docker-compose.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: '2' - -services: - elasticsearch: - container_name: magento2elastic7 - environment: - - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - build: . - ports: - - "9207:9207" -networks: - default: - external: - name: env_default diff --git a/env/additional/mailcatcher/docker-compose.yml b/env/additional/mailcatcher/docker-compose.yml deleted file mode 100644 index 692148d..0000000 --- a/env/additional/mailcatcher/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: '2' - -services: - mailcatcher: - image: schickling/mailcatcher - ports: - - "1080:1080" -networks: - default: - external: - name: env_default - diff --git a/env/additional/opensearch/docker-compose.yaml b/env/additional/opensearch/docker-compose.yaml deleted file mode 100644 index b935890..0000000 --- a/env/additional/opensearch/docker-compose.yaml +++ /dev/null @@ -1,19 +0,0 @@ -version: '3' - -services: - opensearch: - image: opensearchproject/opensearch:1.2.4 - container_name: magento2opensearch - environment: - - "discovery.type=single-node" - - "plugins.security.disabled=true" - - "http.host=0.0.0.0" - - "http.port=9200" - - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx${M2D_OPENSEARCH_MAX_HEAP_SIZE:-512m}" - - "DISABLE_INSTALL_DEMO_CONFIG=true" # disable demo config see https://opensearch.org/docs/latest/opensearch/install/docker-security/ - ports: - - "9200:9200" -networks: - default: - name: env_default - external: true diff --git a/env/additional/rabbitmq/docker-compose.yml b/env/additional/rabbitmq/docker-compose.yml deleted file mode 100644 index 9b5e5ec..0000000 --- a/env/additional/rabbitmq/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: '2' - -services: - rabbitmq: - container_name: magento2rabbitmq - image: rabbitmq:3.8-management - restart: unless-stopped - ports: - - "15672:15672" -networks: - default: - external: - name: env_default diff --git a/env/additional/redis/docker-compose.yml b/env/additional/redis/docker-compose.yml deleted file mode 100644 index 641084a..0000000 --- a/env/additional/redis/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: '2' - -services: - redis: - container_name: magento2redis - image: redis:6.0 -networks: - default: - external: - name: env_default - diff --git a/env/additional/selenium/docker-compose.yml b/env/additional/selenium/docker-compose.yml deleted file mode 100644 index 773ed7a..0000000 --- a/env/additional/selenium/docker-compose.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: '2' - -services: - selenium: - image: selenium/standalone-chrome-debug:3.14.0 - container_name: selenium - volumes: - - /dev/shm:/dev/shm - ports: - - "4444:4444" - - "5900:5900" - shm_size: '2gb' -networks: - default: - external: - name: env_default diff --git a/env/additional/varnish/docker-compose.yml b/env/additional/varnish/docker-compose.yml deleted file mode 100644 index ae85d77..0000000 --- a/env/additional/varnish/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: '2' - -services: - varnish: - container_name: magento2varnish - image: varnish:6.5 - ports: - - "8080:8080" -networks: - default: - external: - name: env_default - diff --git a/env/bin/.init b/env/bin/.init deleted file mode 100644 index 3ac4f17..0000000 --- a/env/bin/.init +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -set -x diff --git a/env/bin/magento-cloud b/env/bin/magento-cloud deleted file mode 100755 index a930dae..0000000 --- a/env/bin/magento-cloud +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -source bin/.init -docker exec -it --user magento magento2web /home/magento/.magento-cloud/bin/magento-cloud ssh-cert:load -docker exec -it --user magento magento2web /home/magento/.magento-cloud/bin/magento-cloud "$@" diff --git a/env/bin/shell b/env/bin/shell deleted file mode 100755 index 30efbc9..0000000 --- a/env/bin/shell +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -source bin/.init - -docker exec -it --user magento magento2web bash diff --git a/env/bin/shell-root b/env/bin/shell-root deleted file mode 100755 index 38d3c53..0000000 --- a/env/bin/shell-root +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -source bin/.init -docker exec -it magento2web bash diff --git a/env/bin/up b/env/bin/up deleted file mode 100755 index 7dfb262..0000000 --- a/env/bin/up +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -source bin/.init -docker-compose up -d -( cd additional/elasticsearch7 && docker-compose up -d && cd - ) diff --git a/env/docker-compose.override.yml.dist b/env/docker-compose.override.yml.dist deleted file mode 100644 index e786957..0000000 --- a/env/docker-compose.override.yml.dist +++ /dev/null @@ -1,8 +0,0 @@ -version: '2' - -services: - web: - volumes: - - "$HOME/.composer:/root/.composer" - - "$HOME/.gitconfig:/root/.gitconfig" - - "$HOME/.bashrc:/root/.bashrc" diff --git a/env/docker-compose.yml b/env/docker-compose.yml deleted file mode 100644 index 111a252..0000000 --- a/env/docker-compose.yml +++ /dev/null @@ -1,54 +0,0 @@ -version: '3' - -services: - web: - hostname: magento2.test - container_name: magento2web - restart: unless-stopped - build: - context: . - args: - - M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} - environment: - - PHP_IDE_CONFIG=serverName=PHPSTORM - - BLACKFIRE_CLIENT_ID - - BLACKFIRE_CLIENT_TOKEN - - MAGENTO_CLOUD_CLI_TOKEN - - COMPOSER_AUTH - ports: - - "80:80" - - "443:443" - - "2222:22" - volumes: - - src-volume:/var/www/html - - src-composer-cache-volume:/root/.composer/cache - - home-volume:/home - - root-volume:/root - cap_add: - - "SYS_PTRACE" - db: - container_name: magento2db - # MariaDB is most common in Cloud - image: mariadb:10.2 - restart: unless-stopped - environment: - MYSQL_DATABASE: magento - MYSQL_ALLOW_EMPTY_PASSWORD: 1 - MYSQL_USER: magento - MYSQL_PASSWORD: magento - ports: - - "3306:3306" - volumes: - - "./etc/mysql:/etc/mysql/conf.d" - - db-volume:/var/lib/mysql - blackfire: - image: blackfire/blackfire - environment: - - BLACKFIRE_SERVER_ID - - BLACKFIRE_SERVER_TOKEN -volumes: - home-volume: - root-volume: - src-volume: - db-volume: - src-composer-cache-volume: diff --git a/env/etc/host/config.sh b/env/etc/host/config.sh deleted file mode 100644 index cf88d1f..0000000 --- a/env/etc/host/config.sh +++ /dev/null @@ -1,8 +0,0 @@ -FS_MOUNT_TYPE='mutagen' -SOURCE_DIRECTORY=$(cd ../src && pwd) - -if [ -f etc/host/config.sh.override ] -then - source etc/host/config.sh.override -fi -echo ${!1} diff --git a/env/etc/m2install/.m2install.conf b/env/etc/m2install/.m2install.conf deleted file mode 100644 index ead69a0..0000000 --- a/env/etc/m2install/.m2install.conf +++ /dev/null @@ -1,19 +0,0 @@ -HTTP_HOST=http://${CURRENT_DIR_NAME}.127.0.0.1.nip.io/ -if [[ `pwd` =~ /var/www/html/[^/]*/[^/]*$ ]] -then - PREVIOUS_DIR_NAME=$(basename "$(cd .. && pwd)") - HTTP_HOST=http://${PREVIOUS_DIR_NAME}.${CURRENT_DIR_NAME}.127.0.0.1.nip.io/ -fi -BASE_PATH=/ -DB_HOST=db -DB_USER=root -DB_PASSWORD= -COMPOSER_VERSION=2.2 -MAGENTO_EE_PATH= -GIT_CE_REPO=git@github.com:magento/magento2.git -GIT_EE_REPO= -GIT_BRANCH=2.2 -SEARCH_ENGINE_ELASTICSEARCH7_HOST="magento2elastic7" -SEARCH_ENGINE_ELASTICSEARCH7_PORT="9207" -SEARCH_ENGINE_ELASTICSEARCH6_HOST="magento2elastic6" -SEARCH_ENGINE_ELASTICSEARCH6_PORT="9206" diff --git a/env/etc/osx.docker.loopback.plist b/env/etc/osx.docker.loopback.plist deleted file mode 100644 index 9d92720..0000000 --- a/env/etc/osx.docker.loopback.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Label - docker.loopback - ProgramArguments - - ifconfig - lo0 - alias - 10.254.254.254 - - RunAtLoad - - - diff --git a/env/etc/php/7.3/Dockerfile b/env/etc/php/7.3/Dockerfile deleted file mode 100644 index d340549..0000000 --- a/env/etc/php/7.3/Dockerfile +++ /dev/null @@ -1,167 +0,0 @@ -#PHP IMAGE -FROM php:7.3-apache-bullseye - -#SETTING UP THE SYSTEM -RUN apt-get update \ - && apt-get install -y \ - apt-utils \ - wget \ - libwebp-dev \ - libxpm-dev \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libxslt-dev \ - libicu-dev \ - mariadb-client \ - pv \ - vim \ - nano \ - bash-completion \ - openssh-server \ - ssl-cert \ - msmtp \ - sudo \ - dnsutils \ - iputils-ping \ - iputils-tracepath \ - host \ - strace \ - telnet \ - unzip \ - gnupg \ - gcc \ - lsof \ - libzip-dev \ - libsodium-dev \ - && apt-get update \ - && apt-get clean all - -#CREATE USER -ENV _USER=magento -ENV _HOME_DIRECTORY=/home/${_USER} -RUN useradd -m ${_USER} && echo "${_USER}:${_USER}" | chpasswd && chsh ${_USER} -s /bin/bash && adduser ${_USER} sudo - -#PHP EXTENSIONS -RUN docker-php-ext-install -j$(nproc) iconv soap sockets \ - && docker-php-ext-configure gd --with-gd --with-webp-dir \ - --with-png-dir --with-zlib-dir --with-xpm-dir \ - --with-freetype-dir=/usr/include/freetype2/ --with-jpeg-dir=/usr/include/ \ - && docker-php-ext-install -j$(nproc) gd bcmath pdo_mysql xsl intl zip \ - && pecl install libsodium-2.0.22 - -#GIT -RUN apt-get update \ - && apt-get install -y git \ - && apt-get clean all - -#NODEJS -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \ - && apt-get install -y nodejs - -#BLACKFIRE -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/linux/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 \ - && mkdir -p /tmp/blackfire \ - && curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire \ - && mv /tmp/blackfire/blackfire /usr/bin/blackfire \ - && rm -Rf /tmp/blackfire - -#COMPOSER -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --1\ - && apt -qy install $PHPIZE_DEPS && mkdir /${_HOME_DIRECTORY}/.composer - -#XDEBUG -ARG M2D_XDEBUG_IDE_KEY=PHPSTORM -ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} -RUN pecl install xdebug-2.9.0 \ - && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh - -#CODESNIFFER -RUN pear install PHP_CodeSniffer \ - && mkdir /usr/local/magento-ecg-code-sniffer \ - && cd /usr/local/magento-ecg-code-sniffer/ && composer require magento-ecg/coding-standard \ - && phpcs --config-set installed_paths /usr/local/magento-ecg-code-sniffer/vendor/magento-ecg/coding-standard - -#SENDMAIL -RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/mailcatcher.ini \ - && echo "memory_limit=4G" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "max_input_vars=10000" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "account default" >> /etc/msmtprc \ - && echo "host mailcatcher" >> /etc/msmtprc \ - && echo "port 1025" >> /etc/msmtprc \ - && echo "auto_from on" >> /etc/msmtprc - -#SSH -COPY ./etc/ssh ${_HOME_DIRECTORY}/.ssh -ADD ./etc/ssh/magento2docker.pub ${_HOME_DIRECTORY}/.ssh/authorized_keys -RUN chmod -R 700 ${_HOME_DIRECTORY}/.ssh \ - && echo " ServerAliveInterval 30" >> /etc/ssh/ssh_config \ - && echo " TCPKeepAlive yes" >> /etc/ssh/ssh_config -COPY ./etc/ssh /root/.ssh -ADD ./etc/ssh/magento2docker.pub /root/.ssh/authorized_keys -RUN chmod -R 700 /root/.ssh \ - && echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc" >> /etc/ssh/sshd_config \ - && touch /root/.ssh/known_hosts \ - && ssh-keygen -F github.com || ssh-keyscan github.com >> /root/.ssh/known_hosts - -#APACHE -RUN a2enmod ssl \ - && a2ensite default-ssl.conf \ - && a2enmod vhost_alias \ - && a2enmod proxy \ - && a2enmod rewrite \ - && chown -R ${_USER}:${_USER} /var/www/html -RUN chown -R ${_USER}:${_USER} ${_HOME_DIRECTORY} - -#BASH COMPLETION -USER magento -RUN echo "source /etc/bash_completion" >> ${_HOME_DIRECTORY}/.bashrc - -#MAGENTO CLI -RUN curl -sS https://accounts.magento.cloud/cli/installer | php -USER root - -#TUNE ENVIRONMENT -RUN echo "Defaults timestamp_timeout=-1" >> /etc/sudoers - -#FLAG TO NOT CACHE ANYTHING FROM THIS POINT, details: https://github.com/docker/docker/issues/1996#issuecomment-185872769 -ARG CACHEBUST=1 - -#CUSTOM CONFIGURATIONS -COPY ./etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig -COPY ./etc/composer/auth.json /${_HOME_DIRECTORY}/.composer/auth.json -COPY ./misc/* /usr/local/bin/ -COPY ./etc/apache/envvars /etc/apache2/envvars -COPY ./etc/apache /etc/apache2/sites-enabled/ -COPY ./etc/fixtures /etc/fixtures -COPY ./etc/m2install/.m2install.conf* ${_HOME_DIRECTORY}/ - -#MAGENTO TOOLS -RUN curl -o /usr/local/bin/m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh \ - && curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion \ - && curl -o /usr/local/bin/n98-magerun2 https://files.magerun.net/n98-magerun2.phar \ - && curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash \ - && curl -o /usr/local/bin/m2-convert-for-composer https://raw.githubusercontent.com/isitnikov/m2-convert-patch-for-composer-install/master/convert-for-composer.php \ - && curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion-enterprise \ - && curl -L -o /tmp/teleport.tar.gz https://github.com/gravitational/teleport/releases/download/v1.3.2/teleport-v1.3.2-linux-amd64-bin.tar.gz \ - && tar -xf /tmp/teleport.tar.gz -C /tmp/ \ - && make -C /tmp/teleport/ \ - && git ls-remote git@github.com:magento-sparta/ee-support-tools.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/ee-support-tools.git /usr/local/src/ee-support-tools; else echo; fi \ - && if [ -d /usr/local/src/ee-support-tools ]; then ln -s /usr/local/src/ee-support-tools/cloud-teleport/cloud-teleport /usr/local/bin/cloud-teleport; else echo; fi - -RUN chmod +x /usr/local/bin/* - -CMD service ssh start; apache2-foreground diff --git a/env/etc/php/7.4/Dockerfile b/env/etc/php/7.4/Dockerfile deleted file mode 100644 index a8f1970..0000000 --- a/env/etc/php/7.4/Dockerfile +++ /dev/null @@ -1,174 +0,0 @@ -#PHP IMAGE -FROM php:7.4-apache-bullseye - -#SETTING UP THE SYSTEM -RUN apt-get update \ - && apt-get install -y \ - apt-utils \ - wget \ - libwebp-dev \ - libxpm-dev \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libxslt-dev \ - libicu-dev \ - mariadb-client \ - pv \ - vim \ - nano \ - bash-completion \ - openssh-server \ - ssl-cert \ - msmtp \ - sudo \ - dnsutils \ - iputils-ping \ - iputils-tracepath \ - host \ - strace \ - telnet \ - unzip \ - gnupg \ - gcc \ - lsof \ - libsodium-dev \ - libzip-dev \ - parallel \ - && apt-get update \ - && apt-get clean all - -#CREATE USER -ENV _USER=magento -ENV _HOME_DIRECTORY=/home/${_USER} -RUN useradd -m ${_USER} && echo "${_USER}:${_USER}" | chpasswd && chsh ${_USER} -s /bin/bash && adduser ${_USER} sudo - -#PHP EXTENSIONS -RUN docker-php-ext-install -j$(nproc) iconv soap sockets \ - && docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \ - && docker-php-ext-install -j$(nproc) gd bcmath pdo_mysql xsl intl zip \ - && pecl install libsodium-2.0.22 - -#GIT -RUN apt-get update \ - && apt-get install -y git \ - && apt-get clean all - -#NODEJS -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \ - && apt-get install -y nodejs - -#BLACKFIRE -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/linux/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 \ - && mkdir -p /tmp/blackfire \ - && curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire \ - && mv /tmp/blackfire/blackfire /usr/bin/blackfire \ - && rm -Rf /tmp/blackfire - -#COMPOSER -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer1 --1\ - && apt -qy install $PHPIZE_DEPS && mkdir /${_HOME_DIRECTORY}/.composer - -#COMPOSER 2 (additional) -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer2 --2 - -#COMPOSER link (1 is default for PHP 7.4) -RUN ln -s /usr/local/bin/composer1 /usr/local/bin/composer - -#XDEBUG -ARG M2D_XDEBUG_IDE_KEY=PHPSTORM -ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} -RUN pecl install xdebug-2.9.0 \ - && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh -COPY ./misc/prepare-mtf.sh /usr/local/bin/prepare-mtf.sh -COPY ./misc/composer-link.sh /usr/local/bin/composer-link.sh - -#CODESNIFFER -RUN pear install PHP_CodeSniffer \ - && mkdir /usr/local/magento-ecg-code-sniffer \ - && cd /usr/local/magento-ecg-code-sniffer/ && composer require magento-ecg/coding-standard \ - && phpcs --config-set installed_paths /usr/local/magento-ecg-code-sniffer/vendor/magento-ecg/coding-standard - -#SENDMAIL -RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/mailcatcher.ini \ - && echo "memory_limit=4G" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "max_input_vars=10000" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "account default" >> /etc/msmtprc \ - && echo "host mailcatcher" >> /etc/msmtprc \ - && echo "port 1025" >> /etc/msmtprc \ - && echo "auto_from on" >> /etc/msmtprc - -#SSH -COPY ./etc/ssh ${_HOME_DIRECTORY}/.ssh -ADD ./etc/ssh/magento2docker.pub ${_HOME_DIRECTORY}/.ssh/authorized_keys -RUN chmod -R 700 ${_HOME_DIRECTORY}/.ssh \ - && echo " ServerAliveInterval 30" >> /etc/ssh/ssh_config \ - && echo " TCPKeepAlive yes" >> /etc/ssh/ssh_config -COPY ./etc/ssh /root/.ssh -ADD ./etc/ssh/magento2docker.pub /root/.ssh/authorized_keys -RUN chmod -R 700 /root/.ssh \ - && echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc" >> /etc/ssh/sshd_config \ - && touch /root/.ssh/known_hosts \ - && ssh-keygen -F github.com || ssh-keyscan github.com >> /root/.ssh/known_hosts - -#APACHE -RUN a2enmod ssl \ - && a2ensite default-ssl.conf \ - && a2enmod vhost_alias \ - && a2enmod proxy \ - && a2enmod rewrite \ - && chown -R ${_USER}:${_USER} /var/www/html -RUN chown -R ${_USER}:${_USER} ${_HOME_DIRECTORY} - -#BASH COMPLETION -USER magento -RUN echo "source /etc/bash_completion" >> ${_HOME_DIRECTORY}/.bashrc - -#MAGENTO CLI -RUN curl -sS https://accounts.magento.cloud/cli/installer | php -USER root - -#TUNE ENVIRONMENT -RUN echo "Defaults timestamp_timeout=-1" >> /etc/sudoers - -#FLAG TO NOT CACHE ANYTHING FROM THIS POINT, details: https://github.com/docker/docker/issues/1996#issuecomment-185872769 -ARG CACHEBUST=1 - -#CUSTOM CONFIGURATIONS -COPY ./etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig -COPY ./etc/composer/auth.json /${_HOME_DIRECTORY}/.composer/auth.json -COPY ./misc/* /usr/local/bin/ -COPY ./etc/apache/envvars /etc/apache2/envvars -COPY ./etc/apache /etc/apache2/sites-enabled/ -COPY ./etc/fixtures /etc/fixtures -COPY ./etc/m2install/.m2install.conf* ${_HOME_DIRECTORY}/ - -#MAGENTO TOOLS -RUN curl -o /usr/local/bin/m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh \ - && curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion \ - && curl -o /usr/local/bin/n98-magerun2 https://files.magerun.net/n98-magerun2.phar \ - && curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash \ - && curl -o /usr/local/bin/m2-convert-for-composer https://raw.githubusercontent.com/isitnikov/m2-convert-patch-for-composer-install/master/convert-for-composer.php \ - && curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion-enterprise \ - && curl -L -o /tmp/teleport.tar.gz https://github.com/gravitational/teleport/releases/download/v1.3.2/teleport-v1.3.2-linux-amd64-bin.tar.gz \ - && tar -xf /tmp/teleport.tar.gz -C /tmp/ \ - && make -C /tmp/teleport/ \ - && git ls-remote git@github.com:magento-sparta/ee-support-tools.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/ee-support-tools.git /usr/local/src/ee-support-tools; else echo; fi \ - && if [ -d /usr/local/src/ee-support-tools ]; then ln -s /usr/local/src/ee-support-tools/cloud-teleport/cloud-teleport /usr/local/bin/cloud-teleport; else echo; fi - -RUN chmod +x /usr/local/bin/* - -CMD service ssh start; apache2-foreground diff --git a/env/etc/php/8.0/Dockerfile b/env/etc/php/8.0/Dockerfile deleted file mode 100644 index b954e9b..0000000 --- a/env/etc/php/8.0/Dockerfile +++ /dev/null @@ -1,172 +0,0 @@ -#PHP IMAGE -FROM php:8.0-apache-bullseye - -#SETTING UP THE SYSTEM -RUN apt-get update \ - && apt-get install -y \ - apt-utils \ - wget \ - libwebp-dev \ - libxpm-dev \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libxslt-dev \ - libicu-dev \ - mariadb-client \ - pv \ - vim \ - nano \ - bash-completion \ - openssh-server \ - ssl-cert \ - msmtp \ - sudo \ - dnsutils \ - iputils-ping \ - iputils-tracepath \ - host \ - strace \ - telnet \ - unzip \ - gnupg \ - gcc \ - lsof \ - libsodium-dev \ - libzip-dev \ - && apt-get update \ - && apt-get clean all - -#CREATE USER -ENV _USER=magento -ENV _HOME_DIRECTORY=/home/${_USER} -RUN useradd -m ${_USER} && echo "${_USER}:${_USER}" | chpasswd && chsh ${_USER} -s /bin/bash && adduser ${_USER} sudo - -#PHP EXTENSIONS -RUN docker-php-ext-install -j$(nproc) iconv soap sockets \ - && docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \ - && docker-php-ext-install -j$(nproc) gd bcmath pdo_mysql xsl intl zip \ - && pecl install libsodium-2.0.23 - -#GIT -RUN apt-get update \ - && apt-get install -y git \ - && apt-get clean all - -#NODEJS -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \ - && apt-get install -y nodejs - -#BLACKFIRE -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/linux/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 \ - && mkdir -p /tmp/blackfire \ - && curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire \ - && mv /tmp/blackfire/blackfire /usr/bin/blackfire \ - && rm -Rf /tmp/blackfire - -#COMPOSER -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer1 --1\ - && apt -qy install $PHPIZE_DEPS && mkdir /${_HOME_DIRECTORY}/.composer \ - -#COMPOSER 2 (additional) -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer2 --2 - -#COMPOSER link (2 is default for PHP 8) -RUN ln -s /usr/local/bin/composer2 /usr/local/bin/composer - -#XDEBUG -ARG M2D_XDEBUG_IDE_KEY=PHPSTORM -ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} -RUN pecl install xdebug-3.0.1 \ - && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh -COPY ./misc/composer-link.sh /usr/local/bin/composer-link.sh - -#CODESNIFFER -RUN pear install PHP_CodeSniffer \ - && mkdir /usr/local/magento-ecg-code-sniffer \ - && cd /usr/local/magento-ecg-code-sniffer/ && composer require magento-ecg/coding-standard \ - && phpcs --config-set installed_paths /usr/local/magento-ecg-code-sniffer/vendor/magento-ecg/coding-standard - -#SENDMAIL -RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/mailcatcher.ini \ - && echo "memory_limit=4G" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "max_input_vars=10000" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "account default" >> /etc/msmtprc \ - && echo "host mailcatcher" >> /etc/msmtprc \ - && echo "port 1025" >> /etc/msmtprc \ - && echo "auto_from on" >> /etc/msmtprc - -#SSH -COPY ./etc/ssh ${_HOME_DIRECTORY}/.ssh -ADD ./etc/ssh/magento2docker.pub ${_HOME_DIRECTORY}/.ssh/authorized_keys -RUN chmod -R 700 ${_HOME_DIRECTORY}/.ssh \ - && echo " ServerAliveInterval 30" >> /etc/ssh/ssh_config \ - && echo " TCPKeepAlive yes" >> /etc/ssh/ssh_config -COPY ./etc/ssh /root/.ssh -ADD ./etc/ssh/magento2docker.pub /root/.ssh/authorized_keys -RUN chmod -R 700 /root/.ssh \ - && echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc" >> /etc/ssh/sshd_config \ - && touch /root/.ssh/known_hosts \ - && ssh-keygen -F github.com || ssh-keyscan github.com >> /root/.ssh/known_hosts - -#APACHE -RUN a2enmod ssl \ - && a2ensite default-ssl.conf \ - && a2enmod vhost_alias \ - && a2enmod proxy \ - && a2enmod rewrite \ - && chown -R ${_USER}:${_USER} /var/www/html -RUN chown -R ${_USER}:${_USER} ${_HOME_DIRECTORY} - -#BASH COMPLETION -USER magento -RUN echo "source /etc/bash_completion" >> ${_HOME_DIRECTORY}/.bashrc - -#MAGENTO CLI -RUN curl -sS https://accounts.magento.cloud/cli/installer | php -USER root - -#TUNE ENVIRONMENT -RUN echo "Defaults timestamp_timeout=-1" >> /etc/sudoers - -#FLAG TO NOT CACHE ANYTHING FROM THIS POINT, details: https://github.com/docker/docker/issues/1996#issuecomment-185872769 -ARG CACHEBUST=1 - -#CUSTOM CONFIGURATIONS -COPY ./etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig -COPY ./etc/composer/auth.json /${_HOME_DIRECTORY}/.composer/auth.json -COPY ./misc/* /usr/local/bin/ -COPY ./etc/apache/envvars /etc/apache2/envvars -COPY ./etc/apache /etc/apache2/sites-enabled/ -COPY ./etc/fixtures /etc/fixtures -COPY ./etc/m2install/.m2install.conf* ${_HOME_DIRECTORY}/ - -#MAGENTO TOOLS -RUN curl -o /usr/local/bin/m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh \ - && curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion \ - && curl -o /usr/local/bin/n98-magerun2 https://files.magerun.net/n98-magerun2.phar \ - && curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash \ - && curl -o /usr/local/bin/m2-convert-for-composer https://raw.githubusercontent.com/isitnikov/m2-convert-patch-for-composer-install/master/convert-for-composer.php \ - && curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion-enterprise \ - && curl -L -o /tmp/teleport.tar.gz https://github.com/gravitational/teleport/releases/download/v1.3.2/teleport-v1.3.2-linux-amd64-bin.tar.gz \ - && tar -xf /tmp/teleport.tar.gz -C /tmp/ \ - && make -C /tmp/teleport/ \ - && git ls-remote git@github.com:magento-sparta/ee-support-tools.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/ee-support-tools.git /usr/local/src/ee-support-tools; else echo; fi \ - && if [ -d /usr/local/src/ee-support-tools ]; then ln -s /usr/local/src/ee-support-tools/cloud-teleport/cloud-teleport /usr/local/bin/cloud-teleport; else echo; fi - -RUN chmod +x /usr/local/bin/* - -CMD service ssh start; apache2-foreground diff --git a/env/etc/php/8.1/Dockerfile b/env/etc/php/8.1/Dockerfile deleted file mode 100644 index e31c9ca..0000000 --- a/env/etc/php/8.1/Dockerfile +++ /dev/null @@ -1,173 +0,0 @@ -#PHP IMAGE -FROM php:8.1-apache-bullseye - -#SETTING UP THE SYSTEM -RUN apt-get update \ - && apt-get install -y \ - apt-utils \ - wget \ - libwebp-dev \ - libxpm-dev \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libxslt-dev \ - libicu-dev \ - mariadb-client \ - pv \ - vim \ - nano \ - bash-completion \ - openssh-server \ - ssl-cert \ - msmtp \ - sudo \ - dnsutils \ - iputils-ping \ - iputils-tracepath \ - host \ - strace \ - telnet \ - unzip \ - gnupg \ - gcc \ - lsof \ - libsodium-dev \ - libzip-dev \ - && apt-get update \ - && apt-get clean all - -#CREATE USER -ENV _USER=magento -ENV _HOME_DIRECTORY=/home/${_USER} -RUN useradd -m ${_USER} && echo "${_USER}:${_USER}" | chpasswd && chsh ${_USER} -s /bin/bash && adduser ${_USER} sudo - -#PHP EXTENSIONS -RUN docker-php-ext-install -j$(nproc) soap sockets \ - && docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \ - && docker-php-ext-install -j$(nproc) gd bcmath pdo_mysql xsl intl zip - -#GIT -RUN apt-get update \ - && apt-get install -y git \ - && apt-get clean all - -#NODEJS -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \ - && apt-get install -y nodejs - -#BLACKFIRE -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/linux/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 \ - && mkdir -p /tmp/blackfire \ - && curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire \ - && mv /tmp/blackfire/blackfire /usr/bin/blackfire \ - && rm -Rf /tmp/blackfire - -#COMPOSER -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer1 --1 \ - && apt -qy install $PHPIZE_DEPS && mkdir /${_HOME_DIRECTORY}/.composer - -#COMPOSER 2 (additional) -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer2 --2 - -#COMPOSER link (2 is default for PHP 8.1) -RUN ln -s /usr/local/bin/composer2 /usr/local/bin/composer - -#XDEBUG -ARG M2D_XDEBUG_IDE_KEY=PHPSTORM -ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} -RUN pecl install xdebug \ - && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh - -# COMPOSER VERSION SWITCHER -COPY ./misc/composer-link.sh /usr/local/bin/composer-link.sh - -#CODESNIFFER -RUN pear install PHP_CodeSniffer \ - && mkdir /usr/local/magento-ecg-code-sniffer \ - && cd /usr/local/magento-ecg-code-sniffer/ && composer require magento-ecg/coding-standard \ - && phpcs --config-set installed_paths /usr/local/magento-ecg-code-sniffer/vendor/magento-ecg/coding-standard - -#SENDMAIL -RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/mailcatcher.ini \ - && echo "memory_limit=2G" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "max_input_vars=10000" >> /usr/local/etc/php/conf.d/custom.ini \ - && echo "account default" >> /etc/msmtprc \ - && echo "host mailcatcher" >> /etc/msmtprc \ - && echo "port 1025" >> /etc/msmtprc \ - && echo "auto_from on" >> /etc/msmtprc - -#SSH -COPY ./etc/ssh ${_HOME_DIRECTORY}/.ssh -ADD ./etc/ssh/magento2docker.pub ${_HOME_DIRECTORY}/.ssh/authorized_keys -RUN chmod -R 700 ${_HOME_DIRECTORY}/.ssh \ - && echo " ServerAliveInterval 30" >> /etc/ssh/ssh_config \ - && echo " TCPKeepAlive yes" >> /etc/ssh/ssh_config -COPY ./etc/ssh /root/.ssh -ADD ./etc/ssh/magento2docker.pub /root/.ssh/authorized_keys -RUN chmod -R 700 /root/.ssh \ - && echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc" >> /etc/ssh/sshd_config \ - && touch /root/.ssh/known_hosts \ - && ssh-keygen -F github.com || ssh-keyscan github.com >> /root/.ssh/known_hosts - -#APACHE -RUN a2enmod ssl \ - && a2ensite default-ssl.conf \ - && a2enmod vhost_alias \ - && a2enmod proxy \ - && a2enmod rewrite \ - && chown -R ${_USER}:${_USER} /var/www/html -RUN chown -R ${_USER}:${_USER} ${_HOME_DIRECTORY} - -#BASH COMPLETION -USER magento -RUN echo "source /etc/bash_completion" >> ${_HOME_DIRECTORY}/.bashrc - -#MAGENTO CLI -RUN curl -sS https://accounts.magento.cloud/cli/installer | php -USER root - -#TUNE ENVIRONMENT -RUN echo "Defaults timestamp_timeout=-1" >> /etc/sudoers - -#FLAG TO NOT CACHE ANYTHING FROM THIS POINT, details: https://github.com/docker/docker/issues/1996#issuecomment-185872769 -ARG CACHEBUST=1 - -#CUSTOM CONFIGURATIONS -COPY ./etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig -COPY ./etc/composer/auth.json /${_HOME_DIRECTORY}/.composer/auth.json -COPY ./misc/* /usr/local/bin/ -COPY ./etc/apache/envvars /etc/apache2/envvars -COPY ./etc/apache /etc/apache2/sites-enabled/ -COPY ./etc/fixtures /etc/fixtures -COPY ./etc/m2install/.m2install.conf* ${_HOME_DIRECTORY}/ - -#MAGENTO TOOLS -RUN curl -o /usr/local/bin/m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh \ - && curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion \ - && curl -o /usr/local/bin/n98-magerun2 https://files.magerun.net/n98-magerun2.phar \ - && curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash \ - && curl -o /usr/local/bin/m2-convert-for-composer https://raw.githubusercontent.com/isitnikov/m2-convert-patch-for-composer-install/master/convert-for-composer.php \ - && curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion-enterprise \ - && curl -L -o /tmp/teleport.tar.gz https://github.com/gravitational/teleport/releases/download/v1.3.2/teleport-v1.3.2-linux-amd64-bin.tar.gz \ - && tar -xf /tmp/teleport.tar.gz -C /tmp/ \ - && make -C /tmp/teleport/ \ - && git ls-remote git@github.com:magento-sparta/ee-support-tools.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/ee-support-tools.git /usr/local/src/ee-support-tools; else echo; fi \ - && if [ -d /usr/local/src/ee-support-tools ]; then ln -s /usr/local/src/ee-support-tools/cloud-teleport/cloud-teleport /usr/local/bin/cloud-teleport; else echo; fi - -RUN chmod +x /usr/local/bin/* - -CMD service ssh start; apache2-foreground diff --git a/services/db-cache/Dockerfile b/services/db-cache/Dockerfile new file mode 100644 index 0000000..67f8da4 --- /dev/null +++ b/services/db-cache/Dockerfile @@ -0,0 +1,16 @@ +ARG M2D_ENABLE_DB_CACHE='no' +ARG M2D_DB_CACHE_VENDOR='redis' +ARG M2D_DB_CACHE_VERSION='6.0' + +FROM scratch as m2d_db_cache_no +COPY tools/dummy/dummy ./ +CMD ["/dummy"] + +FROM redis:5.0-bullseye AS m2d_db_cache_yes_redis_5 +FROM redis:6.0-bullseye AS m2d_db_cache_yes_redis_6 +FROM redis:6.2-bullseye AS m2d_db_cache_yes_redis_6.2 +FROM redis:7.0-bullseye AS m2d_db_cache_yes_redis_7 + +FROM m2d_db_cache_yes_${M2D_DB_CACHE_VENDOR}_${M2D_DB_CACHE_VERSION} AS m2d_db_cache_yes + +FROM m2d_db_cache_${M2D_ENABLE_DB_CACHE} AS m2d_db_cache diff --git a/services/db-engines/Dockerfile b/services/db-engines/Dockerfile new file mode 100644 index 0000000..7bf4067 --- /dev/null +++ b/services/db-engines/Dockerfile @@ -0,0 +1,19 @@ +ARG M2D_DB_ENGINE_VENDOR='mariadb' +ARG M2D_DB_ENGINE_VERSION='10.2' + +FROM mariadb:10.4 AS m2d_db_engine_mariadb_10 + +FROM mariadb:10.2 AS m2d_db_engine_mariadb_10.2 +FROM mariadb:10.3 AS m2d_db_engine_mariadb_10.3 +FROM mariadb:10.4 AS m2d_db_engine_mariadb_10.4 +FROM mariadb:10.6 AS m2d_db_engine_mariadb_10.6 + +FROM --platform=linux/amd64 mysql:5.7 AS m2d_db_engine_mysql_5 +FROM --platform=linux/amd64 mysql:8.0.28 AS m2d_db_engine_mysql_8 + +FROM --platform=linux/amd64 mysql:5.7 AS m2d_db_engine_mysql_5.7 +FROM --platform=linux/amd64 mysql:8.0.28 AS m2d_db_engine_mysql_8.0 +FROM mysql:8.0.28-oracle AS m2d_db_engine_mysql_8.0-oracle + +FROM m2d_db_engine_${M2D_DB_ENGINE_VENDOR}_${M2D_DB_ENGINE_VERSION} AS m2d_db_engine +COPY services/db-engines/etc/mysql/my.cnf /etc/mysql/conf.d diff --git a/env/etc/mysql/my.cnf b/services/db-engines/etc/mysql/my.cnf similarity index 100% rename from env/etc/mysql/my.cnf rename to services/db-engines/etc/mysql/my.cnf diff --git a/services/message-brokers/Dockerfile b/services/message-brokers/Dockerfile new file mode 100644 index 0000000..8d32c4e --- /dev/null +++ b/services/message-brokers/Dockerfile @@ -0,0 +1,14 @@ +ARG M2D_ENABLE_MESSAGE_BROKER='no' +ARG M2D_MESSAGE_BROKER_VENDOR='rabbitmq' +ARG M2D_MESSAGE_BROKER_VERSION='3.8' + +FROM scratch as m2d_message_broker_no +COPY tools/dummy/dummy ./ +CMD ["/dummy"] + +FROM rabbitmq:3.8-management AS m2d_message_broker_rabbitmq_3.8 +FROM rabbitmq:3.9-management AS m2d_message_broker_rabbitmq_3.9 + +FROM m2d_message_broker_${M2D_MESSAGE_BROKER_VENDOR}_${M2D_MESSAGE_BROKER_VERSION} AS m2d_message_broker_yes + +FROM m2d_message_broker_${M2D_ENABLE_MESSAGE_BROKER} AS m2d_message_broker diff --git a/services/search-engines/Dockerfile b/services/search-engines/Dockerfile new file mode 100644 index 0000000..a83b7fe --- /dev/null +++ b/services/search-engines/Dockerfile @@ -0,0 +1,40 @@ +ARG M2D_ENABLE_SEARCH_ENGINE='yes' +ARG M2D_SEARCH_ENGINE_VENDOR='elasticsearch' +ARG M2D_SEARCH_ENGINE_VERSION='7' + +FROM scratch as m2d_search_engine_no +COPY tools/dummy/dummy ./ +CMD ["/dummy"] + +FROM m2d_search_engine_no AS m2d_search_engine_no_opensearch +FROM m2d_search_engine_no AS m2d_search_engine_no_elasticsearch + +FROM opensearchproject/opensearch:1.2.4 AS m2d_search_engine_yes_opensearch_1 +FROM opensearchproject/opensearch:2.5.0 AS m2d_search_engine_yes_opensearch_2 + +FROM opensearchproject/opensearch:1.2.4 AS m2d_search_engine_yes_opensearch_1.2 +FROM opensearchproject/opensearch:2.5.0 AS m2d_search_engine_yes_opensearch_2.5 + +FROM m2d_search_engine_yes_opensearch_${M2D_SEARCH_ENGINE_VERSION} AS m2d_search_engine_yes_opensearch +ENV DISABLE_INSTALL_DEMO_CONFIG=true \ + discovery.type=single-node \ + plugins.security.disabled=true \ + http.host=0.0.0.0 \ + http.port=9200 + +FROM --platform=linux/amd64 elasticsearch:6.8.23 AS m2d_search_engine_yes_elasticsearch_6 +FROM elasticsearch:7.16.3 AS m2d_search_engine_yes_elasticsearch_7 +FROM elasticsearch:8.4.3 AS m2d_search_engine_yes_elasticsearch_8 + +FROM --platform=linux/amd64 elasticsearch:7.6.2 AS m2d_search_engine_yes_elasticsearch_7.6 +FROM --platform=linux/amd64 elasticsearch:7.7.1 AS m2d_search_engine_yes_elasticsearch_7.7 +FROM elasticsearch:7.9.3 AS m2d_search_engine_yes_elasticsearch_7.9 +FROM elasticsearch:7.10.1 AS m2d_search_engine_yes_elasticsearch_7.10 +FROM elasticsearch:7.16.3 AS m2d_search_engine_yes_elasticsearch_7.16 +FROM elasticsearch:7.17.9 AS m2d_search_engine_yes_elasticsearch_7.17 +FROM elasticsearch:8.4.3 AS m2d_search_engine_yes_elasticsearch_8.4 + +FROM m2d_search_engine_yes_elasticsearch_${M2D_SEARCH_ENGINE_VERSION} AS m2d_search_engine_yes_elasticsearch +COPY --chown=elasticsearch:elasticsearch services/search-engines/etc/elasticsearch.yml /usr/share/elasticsearch/config/ + +FROM m2d_search_engine_${M2D_ENABLE_SEARCH_ENGINE}_${M2D_SEARCH_ENGINE_VENDOR} AS m2d_search_engine diff --git a/env/additional/elasticsearch6/config/elasticsearch.yml b/services/search-engines/etc/elasticsearch.yml similarity index 92% rename from env/additional/elasticsearch6/config/elasticsearch.yml rename to services/search-engines/etc/elasticsearch.yml index d6a8a0d..9461cee 100644 --- a/env/additional/elasticsearch6/config/elasticsearch.yml +++ b/services/search-engines/etc/elasticsearch.yml @@ -1,5 +1,5 @@ http.host: 0.0.0.0 -http.port: 9206 +http.port: 9200 indices.query.bool.max_clause_count: 10240 diff --git a/services/web-cache/Dockerfile b/services/web-cache/Dockerfile new file mode 100644 index 0000000..6309dd8 --- /dev/null +++ b/services/web-cache/Dockerfile @@ -0,0 +1,21 @@ +ARG M2D_ENABLE_WEB_CACHE='no' +ARG M2D_WEB_CACHE_VENDOR='varnish' +ARG M2D_WEB_CACHE_VERSION='6.5' + +FROM scratch as m2d_web_cache_no +COPY tools/dummy/dummy ./ +CMD ["/dummy"] + +FROM varnish:6.0 AS m2d_web_cache_yes_varnish_6.0 +FROM --platform=linux/amd64 varnish:6.2 AS m2d_web_cache_yes_varnish_6.2 +FROM --platform=linux/amd64 varnish:6.4 AS m2d_web_cache_yes_varnish_6.4 +FROM --platform=linux/amd64 varnish:6.5 AS m2d_web_cache_yes_varnish_6.5 +FROM varnish:7.0 AS m2d_web_cache_yes_varnish_7.0 +FROM varnish:7.1 AS m2d_web_cache_yes_varnish_7.1 + +FROM m2d_web_cache_yes_varnish_7.0 AS m2d_web_cache_yes_varnish_7 +FROM m2d_web_cache_yes_varnish_6.5 AS m2d_web_cache_yes_varnish_6 + +FROM m2d_web_cache_yes_${M2D_WEB_CACHE_VENDOR}_${M2D_WEB_CACHE_VERSION} AS m2d_web_cache_yes + +FROM m2d_web_cache_${M2D_ENABLE_WEB_CACHE} AS m2d_web_cache diff --git a/services/web-servers/apache/Dockerfile b/services/web-servers/apache/Dockerfile new file mode 100644 index 0000000..7db5461 --- /dev/null +++ b/services/web-servers/apache/Dockerfile @@ -0,0 +1,258 @@ +ARG M2D_WEB_SERVER_PHP_VERSION='8.1' +ARG M2D_ENABLE_BLACKFIRE='no' + +## BASE PHP IMAGE - COMMON FOR ALL PHP VERSIONS ## +FROM php:${M2D_WEB_SERVER_PHP_VERSION}-apache-bullseye AS m2d_web_server_apache_php_base_ + +# SETTING UP THE SYSTEM: +RUN apt-get update \ + && apt-get install -y \ + apt-utils \ + wget \ + libwebp-dev \ + libxpm-dev \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libmcrypt-dev \ + libpng-dev \ + libxslt-dev \ + libicu-dev \ + mariadb-client \ + pv \ + vim \ + nano \ + bash-completion \ + openssh-server \ + ssl-cert \ + msmtp \ + sudo \ + dnsutils \ + iputils-ping \ + iputils-tracepath \ + host \ + strace \ + telnet \ + unzip \ + gnupg \ + gcc \ + lsof \ + libsodium-dev \ + libzip-dev \ + parallel \ + git \ + && apt-get update \ + && apt-get clean all + +# CREATE USER: +ENV _USER=magento +ENV _HOME_DIRECTORY=/home/${_USER} +RUN useradd -m ${_USER} && echo "${_USER}:${_USER}" | chpasswd && chsh ${_USER} -s /bin/bash && adduser ${_USER} sudo + +# COMMON PHP EXTENSIONS: +RUN docker-php-ext-install -j$(nproc) iconv soap sockets \ + && docker-php-ext-install -j$(nproc) bcmath pdo_mysql xsl intl zip + +# NODEJS: +RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \ + && apt-get install -y nodejs + +# INSTALL COMPOSER 1 AND COMPOSER 2: +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer1 --1 \ + && apt -qy install $PHPIZE_DEPS && mkdir /${_HOME_DIRECTORY}/.composer \ + && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer2 --2 + +# TOOLS: +COPY ./services/web-servers/apache/tools/* /usr/local/bin/ + +# SENDMAIL: +RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/mailcatcher.ini \ + && echo "memory_limit=2G" >> /usr/local/etc/php/conf.d/custom.ini \ + && echo "max_input_vars=10000" >> /usr/local/etc/php/conf.d/custom.ini \ + && echo "account default" >> /etc/msmtprc \ + && echo "host mailcatcher" >> /etc/msmtprc \ + && echo "port 1025" >> /etc/msmtprc \ + && echo "auto_from on" >> /etc/msmtprc + +# SSH: +COPY ./services/web-servers/apache/etc/ssh ${_HOME_DIRECTORY}/.ssh +ADD ./services/web-servers/apache/etc/ssh/magento2docker.pub ${_HOME_DIRECTORY}/.ssh/authorized_keys +RUN chmod -R 700 ${_HOME_DIRECTORY}/.ssh \ + && echo " ServerAliveInterval 30" >> /etc/ssh/ssh_config \ + && echo " TCPKeepAlive yes" >> /etc/ssh/ssh_config +COPY ./services/web-servers/apache/etc/ssh /root/.ssh +ADD ./services/web-servers/apache/etc/ssh/magento2docker.pub /root/.ssh/authorized_keys +RUN chmod -R 700 /root/.ssh \ + && echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc" >> /etc/ssh/sshd_config \ + && touch /root/.ssh/known_hosts \ + && ssh-keygen -F github.com || ssh-keyscan github.com >> /root/.ssh/known_hosts + +# APACHE: +RUN a2enmod ssl \ + && a2ensite default-ssl.conf \ + && a2enmod vhost_alias \ + && a2enmod proxy \ + && a2enmod rewrite \ + && chown -R ${_USER}:${_USER} /var/www/html +RUN chown -R ${_USER}:${_USER} ${_HOME_DIRECTORY} + +# BASH COMPLETION: +USER magento +RUN echo "source /etc/bash_completion" >> ${_HOME_DIRECTORY}/.bashrc + +# MAGENTO CLI: +RUN curl -sS https://accounts.magento.cloud/cli/installer | php +USER root + +# TUNE ENVIRONMENT: +RUN echo "Defaults timestamp_timeout=-1" >> /etc/sudoers + +# FLAG TO NOT CACHE ANYTHING FROM THIS POINT, details: https://github.com/docker/docker/issues/1996#issuecomment-185872769 +ARG CACHEBUST=1 + +# CUSTOM CONFIGURATIONS: +COPY ./services/web-servers/apache/etc/apache2 /etc/apache2 +COPY ./services/web-servers/apache/etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig +COPY ./services/web-servers/apache/etc/composer/auth.json* /${_HOME_DIRECTORY}/.composer/ +COPY ./services/web-servers/apache/etc/fixtures /etc/fixtures +COPY ./services/web-servers/apache/etc/m2install/.m2install.conf* ${_HOME_DIRECTORY}/ + +# MAGENTO TOOLS: +RUN curl -o /usr/local/bin/m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh \ + && curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion \ + && curl -o /usr/local/bin/n98-magerun2 https://files.magerun.net/n98-magerun2.phar \ + && curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash \ + && curl -o /usr/local/bin/m2-convert-for-composer https://raw.githubusercontent.com/isitnikov/m2-convert-patch-for-composer-install/master/convert-for-composer.php \ + && curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion-enterprise \ + && curl -L -o /tmp/teleport.tar.gz https://github.com/gravitational/teleport/releases/download/v1.3.2/teleport-v1.3.2-linux-amd64-bin.tar.gz \ + && tar -xf /tmp/teleport.tar.gz -C /tmp/ \ + && make -C /tmp/teleport/ \ + && git ls-remote git@github.com:magento-sparta/ee-support-tools.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/ee-support-tools.git /usr/local/src/ee-support-tools; else echo; fi \ + && if [ -d /usr/local/src/ee-support-tools ]; then ln -s /usr/local/src/ee-support-tools/cloud-teleport/cloud-teleport /usr/local/bin/cloud-teleport; else echo; fi \ + && git ls-remote git@github.com:magento-sparta/m-it.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/m-it.git /usr/local/src/m-it; else echo; fi \ + && if [ -d /usr/local/src/m-it ]; then /usr/local/src/m-it/mit-installer.sh; else echo; fi + +USER magento +RUN if [ -d /usr/local/src/m-it ]; then /usr/local/src/m-it/mit-installer.sh; else echo; fi +USER root + +RUN chmod +x /usr/local/bin/* +## END OF BASE IMAGE ## + + +## BASE IMAGE WITHOUT BLACKFIRE ## +FROM m2d_web_server_apache_php_base_ AS m2d_web_server_apache_php_base_blackfire_no + +## BASE IMAGE WITH BLACKFIRE ## +FROM m2d_web_server_apache_php_base_ AS m2d_web_server_apache_php_base_blackfire_yes + +# BLACKFIRE: +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/linux/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 \ + && mkdir -p /tmp/blackfire \ + && curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire \ + && mv /tmp/blackfire/blackfire /usr/bin/blackfire \ + && rm -Rf /tmp/blackfire +## END OF BASE IMAGE WITH BLACKFIRE ## + +FROM m2d_web_server_apache_php_base_blackfire_${M2D_ENABLE_BLACKFIRE} AS m2d_web_server_apache_blackfire + +## IMAGE ADJUSTMENTS FOR PHP 7.x ## +FROM m2d_web_server_apache_blackfire AS m2d_web_server_apache_php7x + +# COMPOSER 1 LINKED AS DEFAULT: +RUN ln -s /usr/local/bin/composer1 /usr/local/bin/composer + +# XDEBUG: +ARG M2D_XDEBUG_IDE_KEY=PHPSTORM +ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} +RUN pecl install xdebug-2.9.0 \ + && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo ";xdebug.remote_log = /var/www/html/xdebug.log" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo ";xdebug.remote_log_level = 10" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo ";xdebug.remote_port = 9003" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + +# ADDITIONAL EXTENSIONS +RUN pecl install libsodium-2.0.23 +## END OF IMAGE ADJUSTMENTS FOR PHP 7.x ## + + +## IMAGE ADJUSTEMNTS FOR PHP 8.x +FROM m2d_web_server_apache_blackfire AS m2d_web_server_apache_php8x + +# PHP EXTENSIONS GD: +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \ + && docker-php-ext-install -j$(nproc) gd + +# COMPOSER 2 LINKED AS DEFAULT: +RUN ln -s /usr/local/bin/composer2 /usr/local/bin/composer + +# XDEBUG: +ARG M2D_XDEBUG_IDE_KEY=PHPSTORM +ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} +RUN pecl install xdebug \ + && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo ";xdebug.log = /var/www/html/xdebug.log" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo ";xdebug.log_level = 10" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ + && echo ";xdebug.client_port = 9003" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +## END OF IMAGE ADJUSTMENTS FOR PHP 8.x ## + + +## IMAGE ADJUSTEMNTS FOR PHP 7.3 ## +FROM m2d_web_server_apache_php7x AS m2d_web_server_apache_php7.3 +# PHP EXTENSIONS GD: +RUN docker-php-ext-configure gd --with-gd --with-webp-dir \ + --with-png-dir --with-zlib-dir --with-xpm-dir \ + --with-freetype-dir=/usr/include/freetype2/ --with-jpeg-dir=/usr/include/ \ + && docker-php-ext-install -j$(nproc) gd +## END OF IMAGE ADJUSTMENTS FOR PHP 7.3 ## + + +## IMAGE ADJUSTEMNTS FOR PHP 7.4 ## +FROM m2d_web_server_apache_php7x AS m2d_web_server_apache_php7.4 +# PHP EXTENSIONS GD: +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \ + && docker-php-ext-install -j$(nproc) gd +## END OF IMAGE ADJUSTMENTS FOR PHP 7.4 ## + + +## IMAGE ADJUSTEMNTS FOR PHP 8.0 ## +FROM m2d_web_server_apache_php8x AS m2d_web_server_apache_php8.0 + +# ADDITIONAL EXTENSIONS +RUN pecl install libsodium-2.0.23 +## END OF IMAGE ADJUSTMENTS FOR PHP 8.0 ## + + +## IMAGE ADJUSTEMNTS FOR PHP 8.1 ## +FROM m2d_web_server_apache_php8x AS m2d_web_server_apache_php8.1 +## END OF IMAGE ADJUSTMENTS FOR PHP 8.1 ## + + +## IMAGE ADJUSTEMNTS FOR PHP 8.2 ## +FROM m2d_web_server_apache_php8x AS m2d_web_server_apache_php8.2 +## END OF IMAGE ADJUSTMENTS FOR PHP 8.2 ## + + +## TARGET IMAGE ADJUSTEMNTS ## +FROM m2d_web_server_apache_php${M2D_WEB_SERVER_PHP_VERSION} AS web_server +# CODESNIFFER: +RUN pear install PHP_CodeSniffer \ + && mkdir /usr/local/magento-ecg-code-sniffer \ + && cd /usr/local/magento-ecg-code-sniffer/ && composer require magento-ecg/coding-standard \ + && phpcs --config-set installed_paths /usr/local/magento-ecg-code-sniffer/vendor/magento-ecg/coding-standard +CMD service ssh start; apache2-foreground diff --git a/services/web-servers/apache/bin/install.sh b/services/web-servers/apache/bin/install.sh new file mode 100755 index 0000000..82ea980 --- /dev/null +++ b/services/web-servers/apache/bin/install.sh @@ -0,0 +1,156 @@ +#!/usr/bin/env bash +# shellcheck shell=bash + +function _m2d_install_apache_init_ahut_json () +{ + local confirm target_file + + target_file="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)/../etc/composer/auth.json" + + if [[ -f "$target_file" ]]; then + read -p 'You already have auth.json file. Do you want to keep it? [y/n]: ' confirm + + if [[ $confirm == 'y' ]]; then + return 0 + fi + + mv "$target_file" "$target_file.backup" + fi + + if [[ -f ~/.composer/auth.json ]]; then + read -p 'Do you want to use your current auth.json file (from ~/.composer/auth.json)? [y/n]: ' confirm + + if [[ $confirm == 'y' ]]; then + cp ~/.composer/auth.json "$target_file" + return 0 + fi + fi + + read -p 'Do you want to use existing auth.json file? [y/n]: ' confirm + if [[ $confirm == 'y' ]]; then + local auth_json_path + while [[ ! -f "$target_file" ]] + do + read -p 'Provide a path to auth.json file you want to use: ' auth_json_path + auth_json_path=$(realpath "${auth_json_path/#\~/$HOME}" 2> /dev/null) + + echo "$auth_json_path" + + if [[ -f "$auth_json_path" ]]; then + cp "$auth_json_path" "$target_file" + return 0 + fi + + read -p "'$auth_json_path' doesn't exists! Do you want to try again? [y/n]: " confirm + + if [[ $confirm == 'n' ]]; then + break + fi + done + fi + + local username password file_content + read -p 'Provide public key to repo.magento.com: ' username + read -p 'Provide private key to repo.magento.com: ' password + + file_content=$(cat <> "$target_file" +} + +function _m2d_install_apache_init_git_config () +{ + local confirm target_file + + target_file="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)/../etc/git/gitconfig" + + if [[ -f "$target_file" ]]; then + read -p 'You already have gitconfig file. Do you want to keep it? [y/n]: ' confirm + + if [[ $confirm == 'y' ]]; then + return 0 + fi + + mv "$target_file" "$target_file.backup" + fi + + if [[ -f ~/.gitconfig ]]; then + read -p 'Do you want to use your current gitconfig file (from ~/.gitconfig)? [y/n]: ' confirm + + if [[ $confirm == 'y' ]]; then + cp ~/.gitconfig "$target_file" + return 0 + fi + fi + + local email name file_content + read -p 'Provide your email addres: ' email + read -p 'Provide your full name (name and surname): ' name + + file_content=$(cat <> "$target_file" +} + +function _m2d_install_apache_init_certs () +{ + local confirm + local target_path="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)/../etc/ssh" + + if [[ -f ~/.ssh/config ]]; then + read -p 'Do you want to add SSH config file(s) to the web container? [y/n]: ' confirm + + if [[ $confirm == 'y' ]]; then + cp ~/.ssh/config* "$target_path/" + fi + fi + + if [[ -f ~/.ssh/known_hosts ]]; then + read -p 'Do you want to add known_hosts file to the web container? [y/n]: ' confirm + + if [[ $confirm == 'y' ]]; then + cp ~/.ssh/known_hosts "$target_path/" + fi + fi + + read -p 'Do you want to select the SSH keys to be added to the web container? [y/n]: ' confirm + + if [[ $confirm == 'n' ]]; then + return 0 + fi + + for ssh_pub_key in ~/.ssh/*.pub; do + if [[ "$(basename $ssh_pub_key)" == 'magento2docker.pub' ]]; then + continue + fi + + read -p "Add '$ssh_pub_key'? [y/n]: " confirm + + if [[ $confirm != 'y' ]]; then + continue + fi + + cp "$ssh_pub_key" "$target_path/$(basename $ssh_pub_key)" + cp "${ssh_pub_key%.pub}" "$target_path/$(basename ${ssh_pub_key%.pub})" + done +} + +_m2d_install_apache_init_ahut_json +_m2d_install_apache_init_git_config +_m2d_install_apache_init_certs diff --git a/env/etc/apache/envvars b/services/web-servers/apache/etc/apache2/envvars similarity index 100% rename from env/etc/apache/envvars rename to services/web-servers/apache/etc/apache2/envvars diff --git a/env/etc/apache/000-default.conf b/services/web-servers/apache/etc/apache2/sites-enabled/000-default.conf similarity index 100% rename from env/etc/apache/000-default.conf rename to services/web-servers/apache/etc/apache2/sites-enabled/000-default.conf diff --git a/env/etc/apache/second-level.nip.io.conf b/services/web-servers/apache/etc/apache2/sites-enabled/second-level.nip.io.conf similarity index 100% rename from env/etc/apache/second-level.nip.io.conf rename to services/web-servers/apache/etc/apache2/sites-enabled/second-level.nip.io.conf diff --git a/env/etc/apache/vhost.conf.example b/services/web-servers/apache/etc/apache2/sites-enabled/vhost.conf.example similarity index 100% rename from env/etc/apache/vhost.conf.example rename to services/web-servers/apache/etc/apache2/sites-enabled/vhost.conf.example diff --git a/services/web-servers/apache/etc/composer/.gitignore b/services/web-servers/apache/etc/composer/.gitignore new file mode 100755 index 0000000..314ca1e --- /dev/null +++ b/services/web-servers/apache/etc/composer/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!auth.json.example diff --git a/env/etc/composer/auth.json.example b/services/web-servers/apache/etc/composer/auth.json.example similarity index 100% rename from env/etc/composer/auth.json.example rename to services/web-servers/apache/etc/composer/auth.json.example diff --git a/env/etc/fixtures/.gitignore b/services/web-servers/apache/etc/fixtures/.gitignore similarity index 100% rename from env/etc/fixtures/.gitignore rename to services/web-servers/apache/etc/fixtures/.gitignore diff --git a/env/etc/fixtures/config.example.xml.dist b/services/web-servers/apache/etc/fixtures/config.example.xml.dist similarity index 100% rename from env/etc/fixtures/config.example.xml.dist rename to services/web-servers/apache/etc/fixtures/config.example.xml.dist diff --git a/env/etc/fixtures/small.example.xml.dist b/services/web-servers/apache/etc/fixtures/small.example.xml.dist similarity index 100% rename from env/etc/fixtures/small.example.xml.dist rename to services/web-servers/apache/etc/fixtures/small.example.xml.dist diff --git a/services/web-servers/apache/etc/git/.gitignore b/services/web-servers/apache/etc/git/.gitignore new file mode 100644 index 0000000..d5479b8 --- /dev/null +++ b/services/web-servers/apache/etc/git/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!gitconfig.example diff --git a/env/etc/git/gitconfig.example b/services/web-servers/apache/etc/git/gitconfig.example similarity index 100% rename from env/etc/git/gitconfig.example rename to services/web-servers/apache/etc/git/gitconfig.example diff --git a/services/web-servers/apache/etc/m2install/.gitignore b/services/web-servers/apache/etc/m2install/.gitignore new file mode 100644 index 0000000..9c10fa6 --- /dev/null +++ b/services/web-servers/apache/etc/m2install/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!.m2install.conf diff --git a/services/web-servers/apache/etc/m2install/.m2install.conf b/services/web-servers/apache/etc/m2install/.m2install.conf new file mode 100644 index 0000000..a9c664f --- /dev/null +++ b/services/web-servers/apache/etc/m2install/.m2install.conf @@ -0,0 +1,23 @@ +HTTP_HOST=http://${CURRENT_DIR_NAME}.127.0.0.1.nip.io/ +if [[ `pwd` =~ /var/www/html/[^/]*/[^/]*$ ]] +then + PREVIOUS_DIR_NAME=$(basename "$(cd .. && pwd)") + HTTP_HOST=http://${PREVIOUS_DIR_NAME}.${CURRENT_DIR_NAME}.127.0.0.1.nip.io/ +fi +BASE_PATH=/ +DB_HOST=db +DB_USER=root +DB_PASSWORD= +COMPOSER_VERSION=2.2 +MAGENTO_EE_PATH= +GIT_CE_REPO=git@github.com:magento/magento2.git +GIT_EE_REPO= +GIT_BRANCH=2.4-develop +SEARCH_ENGINE_ELASTICSEARCH7_HOST="m2d-searchengine" +SEARCH_ENGINE_ELASTICSEARCH7_PORT="9200" +SEARCH_ENGINE_ELASTICSEARCH6_HOST="m2d-searchengine" +SEARCH_ENGINE_ELASTICSEARCH6_PORT="9200" +SEARCH_ENGINE_ELASTICSEARCH5_HOST="m2d-searchengine" +SEARCH_ENGINE_ELASTICSEARCH5_PORT="9200" +SEARCH_ENGINE_ELASTICSEARCH2_HOST="m2d-searchengine" +SEARCH_ENGINE_ELASTICSEARCH2_PORT="9200" diff --git a/env/etc/ssh/.gitignore b/services/web-servers/apache/etc/ssh/.gitignore similarity index 100% rename from env/etc/ssh/.gitignore rename to services/web-servers/apache/etc/ssh/.gitignore diff --git a/env/etc/ssh/magento2docker b/services/web-servers/apache/etc/ssh/magento2docker similarity index 100% rename from env/etc/ssh/magento2docker rename to services/web-servers/apache/etc/ssh/magento2docker diff --git a/env/etc/ssh/magento2docker.pub b/services/web-servers/apache/etc/ssh/magento2docker.pub similarity index 100% rename from env/etc/ssh/magento2docker.pub rename to services/web-servers/apache/etc/ssh/magento2docker.pub diff --git a/env/misc/composer-link.sh b/services/web-servers/apache/tools/composer-link.sh similarity index 100% rename from env/misc/composer-link.sh rename to services/web-servers/apache/tools/composer-link.sh diff --git a/env/misc/prepare-mtf.sh b/services/web-servers/apache/tools/prepare-mtf.sh similarity index 100% rename from env/misc/prepare-mtf.sh rename to services/web-servers/apache/tools/prepare-mtf.sh diff --git a/env/misc/xdebug-php.sh b/services/web-servers/apache/tools/xdebug-php.sh similarity index 100% rename from env/misc/xdebug-php.sh rename to services/web-servers/apache/tools/xdebug-php.sh diff --git a/tools/blackfire/Dockerfile b/tools/blackfire/Dockerfile new file mode 100644 index 0000000..9a0ceb8 --- /dev/null +++ b/tools/blackfire/Dockerfile @@ -0,0 +1,9 @@ +ARG M2D_ENABLE_BLACKFIRE='no' + +FROM scratch as m2d_blackfire_no +COPY tools/dummy/dummy ./ +CMD ["/dummy"] + +FROM blackfire/blackfire AS m2d_blackfire_yes + +FROM m2d_blackfire_${M2D_ENABLE_BLACKFIRE} AS m2d_blackfire diff --git a/tools/dummy/README.md b/tools/dummy/README.md new file mode 100644 index 0000000..2435bc8 --- /dev/null +++ b/tools/dummy/README.md @@ -0,0 +1,55 @@ +## Introduction +Dummy - is a lightweight container that executes dummy binary that does nothing. +You can use it whenever you need a dummy container. + +## How to use it? +The idea is to create containers when necessary. But it is hard in Docker as there are no if statements. So the trick is to use environment variables and a dummy container. +Let's assume you need Mailcatcher. This is what your setup can look like: +1. Add Mailcatcher to docker-compose.yaml file: +```yaml +mailcatcher: + build: + context: . + dockerfile: tools/mailcatcher/Dockerfile + target: m2d_mailcatcher + args: + - M2D_ENABLE_MAILCATCHER=${M2D_ENABLE_MAILCATCHER:-no} + container_name: magento2mailcatcher + ports: + - "${M2D_PORT_FOR_MAILCATCHER:-1080}:1080" +``` +2. Add Dockerfile for Mailcatcher: +```Dockerfile +## set the default value for the argument if not defined +ARG M2D_ENABLE_MAILCATCHER='no' + +## prepare a dummy container for the "no" option +FROM scratch as m2d_mailcatcher_no +COPY tools/dummy/dummy ./ +CMD ["/dummy"] + +## prepare the actual Mailcatcher container for the "yes" option +FROM schickling/mailcatcher AS m2d_mailcatcher_yes + +## build target container from mailcatcher_yes or mailcatcher_no based on value from M2D_ENABLE_MAILCATCHER argument +FROM m2d_mailcatcher_${M2D_ENABLE_MAILCATCHER} AS m2d_mailcatcher +``` +3. Set expected value for argument: +- in .env file: +``` +M2D_ENABLE_MAILCATCHER=yes +``` +- or in the terminal: +```bash +export M2D_ENABLE_MAILCATCHER=yes +``` +4. Spin up the expected container: +```bash +docker-composer up -d --build +``` + +## Need more? +If you need a dummy container that is doing something (e.g., displaying hello world), you can modify the source code and recompile it with the following: +```bash +gcc -o tools/dummy/dummy tools/dummy/dummy.c +``` \ No newline at end of file diff --git a/tools/dummy/dummy b/tools/dummy/dummy new file mode 100755 index 0000000..b3c3b39 Binary files /dev/null and b/tools/dummy/dummy differ diff --git a/tools/dummy/dummy.c b/tools/dummy/dummy.c new file mode 100644 index 0000000..4cce7f6 --- /dev/null +++ b/tools/dummy/dummy.c @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/tools/mailcatcher/Dockerfile b/tools/mailcatcher/Dockerfile new file mode 100644 index 0000000..14933eb --- /dev/null +++ b/tools/mailcatcher/Dockerfile @@ -0,0 +1,13 @@ +## set the default value for the argument if not defined +ARG M2D_ENABLE_MAILCATCHER='no' + +## prepare a dummy container for the "no" option +FROM scratch as m2d_mailcatcher_no +COPY tools/dummy/dummy ./ +CMD ["/dummy"] + +## prepare the actual Mailcatcher container for the "yes" option +FROM schickling/mailcatcher AS m2d_mailcatcher_yes + +## build target container from mailcatcher_yes or mailcatcher_no based on value from M2D_ENABLE_MAILCATCHER argument +FROM m2d_mailcatcher_${M2D_ENABLE_MAILCATCHER} AS m2d_mailcatcher diff --git a/env/additional/phpstorm/Dockerfile b/tools/phpstorm/Dockerfile similarity index 75% rename from env/additional/phpstorm/Dockerfile rename to tools/phpstorm/Dockerfile index 71ca94b..68e0155 100644 --- a/env/additional/phpstorm/Dockerfile +++ b/tools/phpstorm/Dockerfile @@ -12,12 +12,12 @@ ENV _HOME_DIRECTORY=/home/${_USER} RUN useradd -m ${_USER} && echo "${_USER}:${_USER}" | chpasswd && chsh ${_USER} -s /bin/bash && adduser ${_USER} sudo #SSH -COPY ./etc/ssh ${_HOME_DIRECTORY}/.ssh +COPY ./services/web-servers/apache/etc/ssh ${_HOME_DIRECTORY}/.ssh RUN chmod -R 700 ${_HOME_DIRECTORY}/.ssh #GIT -COPY ./etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig -COPY ./etc/composer/auth.json ${_HOME_DIRECTORY}/.composer/auth.json +COPY ./services/web-servers/apache/etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig +COPY ./services/web-servers/apache/etc/composer/auth.json ${_HOME_DIRECTORY}/.composer/auth.json RUN chown -R ${_USER}:${_USER} ${_HOME_DIRECTORY} diff --git a/tools/selenium/Dockerfile b/tools/selenium/Dockerfile new file mode 100644 index 0000000..38c36cb --- /dev/null +++ b/tools/selenium/Dockerfile @@ -0,0 +1,19 @@ +ARG M2D_ENABLE_SELENIUM='no' +ARG M2D_SELENIUM_VERSION='3.14.0' +ARG M2D_CPU_TYPE='m1' + +FROM scratch as m2d_selenium_no +COPY tools/dummy/dummy ./ +CMD ["/dummy"] + +FROM m2d_selenium_no AS m2d_selenium_no_m1 +FROM m2d_selenium_no AS m2d_selenium_no_intel + +FROM selenium/standalone-chrome-debug:${M2D_SELENIUM_VERSION} AS m2d_selenium_yes_intel + +# there are no official versions compiled for Apple M1; +# there is https://hub.docker.com/u/seleniarm but they not offer standalone-chrome-debug +# the below will pick an image for the amd64 platform, and it will be executed in emulation mode so that it will be SLOW! +FROM --platform=linux/amd64 selenium/standalone-chrome-debug:${M2D_SELENIUM_VERSION} AS m2d_selenium_yes_m1 + +FROM m2d_selenium_${M2D_ENABLE_SELENIUM}_${M2D_CPU_TYPE} AS m2d_selenium