Skip to content

Commit a3a9bcb

Browse files
authored
Merge pull request #1 from echo-magento/develop
Develop
2 parents 22f14f4 + b6b1bcc commit a3a9bcb

21 files changed

+405
-37
lines changed

README.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@
44

55
# Magento 2 Docker to Development
66

7-
### Magento 2.4.0 + Apache 2.4 + PHP 7.3 + MariaDB 10.4.13 + Elasticsearch 7.6.0 + Varnish 6.4.0 + Redis + OPCache + N98 Magerun 2 + XDebug
7+
### Features
8+
9+
- Magento 2.4
10+
- Apache
11+
- PHP 7.1, PHP 7.2, PHP 7.3
12+
- Xdebug
13+
- Composer 1.10.17
14+
- MariaDB 10.4.13
15+
- Elasticsearch 7.6
16+
- Varnish 6.4
17+
- Redis
18+
- MailHog
19+
- n98-magerun
820

921
### Requirements
1022

@@ -47,6 +59,8 @@ rm index.php
4759
install-magento2
4860
```
4961

62+
> If you want to use Varnish use `docker-compose.varnish.yml`
63+
>
5064
> If you don't want to use Varnish and Elasticsearch use `docker-compose.light.yml`
5165
5266
### Panels
@@ -59,14 +73,15 @@ install-magento2
5973

6074
| Commands | Description | Options & Examples |
6175
|---|---|---|
62-
| `./init` | If you didn't use the CURL setup command above, please use this command changing the name of the project. | `./init MYMAGENTO2` |
63-
| `./start` | If you continuing not using the CURL you can start your container manually | |
64-
| `./stop` | Stop your project containers | |
65-
| `./kill` | Stops containers and removes containers, networks, volumes, and images created to the specific project | |
66-
| `./shell` | Access your container | `./shell root` | |
67-
| `./magento` | Use the power of the Magento CLI | |
68-
| `./n98` | Use the Magerun commands as you want | |
69-
| `./grunt-init` | Prepare to use Grunt | |
70-
| `./grunt` | Use Grunt specifically in your theme or completely, it'll do the deploy and the watcher. | `./grunt luma` |
71-
| `./xdebug` | Enable / Disable the XDebug | |
72-
| `./composer` | Use Composer commands | `./composer update` |
76+
| `bin/init` | If you didn't use the CURL setup command above, please use this command changing the name of the project. | `./init MYMAGENTO2` |
77+
| `bin/start` | If you continuing not using the CURL you can start your container manually | |
78+
| `bin/stop` | Stop your project containers | |
79+
| `bin/kill` | Stops containers and removes containers, networks, volumes, and images created to the specific project | |
80+
| `bin/shell` | Access your container | `./shell root` | |
81+
| `bin/magento` | Use the power of the Magento CLI | |
82+
| `bin/magento-basic` | All basic Magento CLI commands (setup:upgrade, setup:di:compile, setup:static-content:deploy -f, cache:clean, cache:flush) | |
83+
| `bin/n98` | Use the Magerun commands as you want | |
84+
| `bin/grunt-init` | Prepare to use Grunt | |
85+
| `bin/grunt` | Use Grunt specifically in your theme or completely, it'll do the deploy and the watcher. | `./grunt luma` |
86+
| `bin/xdebug` | Enable / Disable the XDebug | |
87+
| `bin/composer` | Use Composer commands | `./composer update` |

backups/.gitkeep

Whitespace-only changes.

composer renamed to bin/composer

File renamed without changes.

grunt renamed to bin/grunt

File renamed without changes.
File renamed without changes.

init renamed to bin/init

File renamed without changes.

kill renamed to bin/kill

File renamed without changes.

magento renamed to bin/magento

File renamed without changes.

bin/magento-basic

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
docker-compose exec --user www-data apache /var/www/html/bin/magento setup:upgrade
3+
docker-compose exec --user www-data apache /var/www/html/bin/magento setup:di:compile
4+
docker-compose exec --user www-data apache /var/www/html/bin/magento setup:static-content:deploy -f
5+
docker-compose exec --user www-data apache /var/www/html/bin/magento cache:clean
6+
docker-compose exec --user www-data apache /var/www/html/bin/magento cache:flush

n98 renamed to bin/n98

File renamed without changes.

opcache renamed to bin/opcache

File renamed without changes.

shell renamed to bin/shell

File renamed without changes.

start renamed to bin/start

File renamed without changes.

stop renamed to bin/stop

File renamed without changes.

xdebug renamed to bin/xdebug

File renamed without changes.

build/apache/php-7.1/Dockerfile

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
FROM php:7.1-apache
2+
3+
MAINTAINER echo <echo.magento@gmail.com>
4+
5+
ENV XDEBUG_PORT 9000
6+
7+
# Install System Dependencies
8+
9+
RUN apt-get update \
10+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
11+
software-properties-common \
12+
&& apt-get update \
13+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
14+
nodejs \
15+
libfreetype6-dev \
16+
libicu-dev \
17+
libssl-dev \
18+
libjpeg62-turbo-dev \
19+
libmcrypt-dev \
20+
libedit-dev \
21+
libedit2 \
22+
libxslt1-dev \
23+
libzip-dev \
24+
apt-utils \
25+
gnupg \
26+
redis-tools \
27+
mariadb-client \
28+
git \
29+
vim \
30+
wget \
31+
curl \
32+
lynx \
33+
psmisc \
34+
unzip \
35+
tar \
36+
cron \
37+
bash-completion \
38+
&& apt-get clean
39+
40+
# Install Magento Dependencies
41+
42+
RUN docker-php-ext-configure \
43+
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \
44+
docker-php-ext-install \
45+
opcache \
46+
gd \
47+
bcmath \
48+
intl \
49+
mbstring \
50+
pdo_mysql \
51+
soap \
52+
xsl \
53+
zip \
54+
sockets
55+
56+
# Install oAuth
57+
58+
RUN apt-get update \
59+
&& apt-get install -y \
60+
libpcre3 \
61+
libpcre3-dev \
62+
# php-pear \
63+
&& pecl install oauth \
64+
&& echo "extension=oauth.so" > /usr/local/etc/php/conf.d/docker-php-ext-oauth.ini
65+
66+
# Install Node, NVM, NPM and Grunt
67+
68+
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
69+
&& apt-get install -y nodejs build-essential \
70+
&& npm i -g grunt-cli yarn
71+
72+
# Install Composer
73+
74+
RUN curl -sS https://getcomposer.org/installer | php -- --version=1.10.17 --install-dir=/usr/local/bin/ --filename=composer
75+
76+
# Install Code Sniffer
77+
78+
RUN git clone https://github.com/magento/marketplace-eqp.git ~/.composer/vendor/magento/marketplace-eqp
79+
RUN cd ~/.composer/vendor/magento/marketplace-eqp && composer install
80+
RUN ln -s ~/.composer/vendor/magento/marketplace-eqp/vendor/bin/phpcs /usr/local/bin;
81+
82+
ENV PATH="/var/www/.composer/vendor/bin/:${PATH}"
83+
84+
# Install XDebug
85+
86+
RUN yes | pecl install xdebug && \
87+
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.iniOLD
88+
89+
# Install Mhsendmail
90+
91+
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang-go \
92+
&& mkdir /opt/go \
93+
&& export GOPATH=/opt/go \
94+
&& go get github.com/mailhog/mhsendmail
95+
96+
# Install Magerun 2
97+
98+
RUN wget https://files.magerun.net/n98-magerun2.phar \
99+
&& chmod +x ./n98-magerun2.phar \
100+
&& mv ./n98-magerun2.phar /usr/local/bin/
101+
102+
# Configuring system
103+
104+
ADD /.docker/config/php.ini /usr/local/etc/php/php.ini
105+
ADD /.docker/config/magento.conf /etc/apache2/sites-available/magento.conf
106+
ADD /.docker/config/custom-xdebug.ini /usr/local/etc/php/conf.d/custom-xdebug.ini
107+
COPY /.docker/bin/* /usr/local/bin/
108+
COPY /.docker/users/* /var/www/
109+
RUN chmod +x /usr/local/bin/*
110+
RUN ln -s /etc/apache2/sites-available/magento.conf /etc/apache2/sites-enabled/magento.conf
111+
112+
RUN curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion
113+
RUN 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
114+
RUN echo "source /etc/bash_completion" >> /root/.bashrc
115+
RUN echo "source /etc/bash_completion" >> /var/www/.bashrc
116+
117+
RUN chmod 777 -Rf /var/www /var/www/.* \
118+
&& chown -Rf www-data:www-data /var/www /var/www/.* \
119+
&& usermod -u 1000 www-data \
120+
&& chsh -s /bin/bash www-data\
121+
&& a2enmod rewrite \
122+
&& a2enmod headers
123+
124+
RUN su -c "composer global require hirak/prestissimo" -s /bin/sh www-data
125+
126+
VOLUME /var/www/html
127+
WORKDIR /var/www/html

build/apache/php-7.2/Dockerfile

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
FROM php:7.2-apache
2+
3+
MAINTAINER echo <echo.magento@gmail.com>
4+
5+
ENV XDEBUG_PORT 9000
6+
7+
# Install System Dependencies
8+
9+
RUN apt-get update \
10+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
11+
software-properties-common \
12+
&& apt-get update \
13+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
14+
nodejs \
15+
libfreetype6-dev \
16+
libicu-dev \
17+
libssl-dev \
18+
libjpeg62-turbo-dev \
19+
libmcrypt-dev \
20+
libedit-dev \
21+
libedit2 \
22+
libxslt1-dev \
23+
libzip-dev \
24+
apt-utils \
25+
gnupg \
26+
redis-tools \
27+
mariadb-client \
28+
git \
29+
vim \
30+
wget \
31+
curl \
32+
lynx \
33+
psmisc \
34+
unzip \
35+
tar \
36+
cron \
37+
bash-completion \
38+
&& apt-get clean
39+
40+
# Install Magento Dependencies
41+
42+
RUN docker-php-ext-configure \
43+
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \
44+
docker-php-ext-install \
45+
opcache \
46+
gd \
47+
bcmath \
48+
intl \
49+
mbstring \
50+
pdo_mysql \
51+
soap \
52+
xsl \
53+
zip \
54+
sockets
55+
56+
# Install oAuth
57+
58+
RUN apt-get update \
59+
&& apt-get install -y \
60+
libpcre3 \
61+
libpcre3-dev \
62+
# php-pear \
63+
&& pecl install oauth \
64+
&& echo "extension=oauth.so" > /usr/local/etc/php/conf.d/docker-php-ext-oauth.ini
65+
66+
# Install Node, NVM, NPM and Grunt
67+
68+
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
69+
&& apt-get install -y nodejs build-essential \
70+
&& npm i -g grunt-cli yarn
71+
72+
# Install Composer
73+
74+
RUN curl -sS https://getcomposer.org/installer | php -- --version=1.10.17 --install-dir=/usr/local/bin/ --filename=composer
75+
76+
# Install Code Sniffer
77+
78+
RUN git clone https://github.com/magento/marketplace-eqp.git ~/.composer/vendor/magento/marketplace-eqp
79+
RUN cd ~/.composer/vendor/magento/marketplace-eqp && composer install
80+
RUN ln -s ~/.composer/vendor/magento/marketplace-eqp/vendor/bin/phpcs /usr/local/bin;
81+
82+
ENV PATH="/var/www/.composer/vendor/bin/:${PATH}"
83+
84+
# Install XDebug
85+
86+
RUN yes | pecl install xdebug && \
87+
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.iniOLD
88+
89+
# Install Mhsendmail
90+
91+
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang-go \
92+
&& mkdir /opt/go \
93+
&& export GOPATH=/opt/go \
94+
&& go get github.com/mailhog/mhsendmail
95+
96+
# Install Magerun 2
97+
98+
RUN wget https://files.magerun.net/n98-magerun2.phar \
99+
&& chmod +x ./n98-magerun2.phar \
100+
&& mv ./n98-magerun2.phar /usr/local/bin/
101+
102+
# Configuring system
103+
104+
ADD /.docker/config/php.ini /usr/local/etc/php/php.ini
105+
ADD /.docker/config/magento.conf /etc/apache2/sites-available/magento.conf
106+
ADD /.docker/config/custom-xdebug.ini /usr/local/etc/php/conf.d/custom-xdebug.ini
107+
COPY /.docker/bin/* /usr/local/bin/
108+
COPY /.docker/users/* /var/www/
109+
RUN chmod +x /usr/local/bin/*
110+
RUN ln -s /etc/apache2/sites-available/magento.conf /etc/apache2/sites-enabled/magento.conf
111+
112+
RUN curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion
113+
RUN 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
114+
RUN echo "source /etc/bash_completion" >> /root/.bashrc
115+
RUN echo "source /etc/bash_completion" >> /var/www/.bashrc
116+
117+
RUN chmod 777 -Rf /var/www /var/www/.* \
118+
&& chown -Rf www-data:www-data /var/www /var/www/.* \
119+
&& usermod -u 1000 www-data \
120+
&& chsh -s /bin/bash www-data\
121+
&& a2enmod rewrite \
122+
&& a2enmod headers
123+
124+
RUN su -c "composer global require hirak/prestissimo" -s /bin/sh www-data
125+
126+
VOLUME /var/www/html
127+
WORKDIR /var/www/html

build/apache/Dockerfile renamed to build/apache/php-7.3/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ RUN docker-php-ext-configure \
4848
intl \
4949
mbstring \
5050
mysqli \
51-
mcrypt \
5251
pdo_mysql \
5352
soap \
5453
xsl \
@@ -73,8 +72,7 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
7372

7473
# Install Composer
7574

76-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
77-
RUN composer global require hirak/prestissimo
75+
RUN curl -sS https://getcomposer.org/installer | php -- --version=1.10.17 --install-dir=/usr/local/bin/ --filename=composer
7876

7977
# Install Code Sniffer
8078

@@ -124,5 +122,7 @@ RUN chmod 777 -Rf /var/www /var/www/.* \
124122
&& a2enmod rewrite \
125123
&& a2enmod headers
126124

125+
RUN su -c "composer global require hirak/prestissimo" -s /bin/sh www-data
126+
127127
VOLUME /var/www/html
128128
WORKDIR /var/www/html

docker-compose.light.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ services:
33
apache:
44
build:
55
context: .
6-
dockerfile: build/apache/Dockerfile
6+
dockerfile: build/apache/php-7.3/Dockerfile
77
ports:
88
- "80:80"
99
- "9001:9000" # xdebug
1010
volumes:
1111
- ./src:/var/www/html
12-
- ~/.composer:/var/www/.composer
12+
- ~/.composer/cache:/var/www/.composer/cache
1313
- ~/.npm:/var/www/.npm
1414
environment:
1515
XDEBUG_CONFIG: "remote_host=localhost"
1616
PHP_IDE_CONFIG: "serverName=Docker"
17+
# VIRTUAL_HOST: "example.localhost"
1718
depends_on:
1819
- db
1920
links:
@@ -32,6 +33,7 @@ services:
3233
- MYSQL_PASSWORD=admin123
3334
volumes:
3435
- dbdata:/var/lib/mysql
36+
- ./backups:/var/tmp/backups
3537
networks:
3638
- <project_name>-network
3739

0 commit comments

Comments
 (0)