Skip to content

Commit 651f33a

Browse files
Merge pull request #52 from magento-commerce/develop-to-1.2
Merge develop into 1.2
2 parents d02eacb + bc6f535 commit 651f33a

File tree

110 files changed

+2052
-853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2052
-853
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
/auth.json
77
/_workdir
88
/_workdir_cache
9+
/venv
10+
/*.code-workspace
911
.phpunit.result.cache

LICENSE_MIT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) Meanbee and Taylor Otwell
3+
Copyright (c) Meanbee, Taylor Otwell and Mage Inferno
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

bin/init-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ domain_is_valid()
5555

5656
composer_install()
5757
{
58-
docker run --rm -e "MAGENTO_ROOT=/app" -v "$(pwd)":/app -v ~/.composer/cache:/root/.composer/cache "magento/magento-cloud-docker-php:${PHP_VERSION}-cli-${IMAGE_VERSION}" composer install --ansi
58+
docker run --rm -e "MAGENTO_ROOT=/app" -v "$(pwd)":/app -v ~/.composer/cache:/composer/cache "magento/magento-cloud-docker-php:${PHP_VERSION}-cli-${IMAGE_VERSION}" composer install --ansi
5959
}
6060

6161
add_host()

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"name": "magento/magento-cloud-docker",
33
"description": "Magento Cloud Docker",
44
"type": "magento2-component",
5-
"version": "1.2.2",
5+
"version": "1.2.3",
66
"license": [
77
"OSL-3.0",
88
"AFL-3.0"
99
],
1010
"require": {
1111
"php": "^7.2",
1212
"ext-json": "*",
13-
"composer/composer": "^1.0",
13+
"composer/composer": "^1.0||^2.0",
1414
"composer/semver": "^1.0",
1515
"illuminate/config": "^5.5",
1616
"symfony/config": "^4.4",

dist/bin/magento-docker

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ USAGE="Magento Cloud Docker
66
77
\033[33mArguments:\033[0m
88
pull pull latest images
9-
up destroy, re-create and start containers
9+
init destroy, re-create and start containers and volumes
10+
up create or start containers
1011
down destroy containers
1112
bash connect to bash
1213
stop stop containers
@@ -23,15 +24,61 @@ USAGE="Magento Cloud Docker
2324
php 7.2 run a command in a PHP 7.2 container
2425
php 7.3 run a command in a PHP 7.3 container
2526
php 7.4 run a command in a PHP 7.4 container
27+
php 8.0 run a command in a PHP 8.0 container
28+
copy-to copy to container (use --all or specific file/directory)
29+
copy-from copy from container (use --all or specific file/directory)
30+
fix-owns fix ownership to www:www
2631
2732
\033[33mOptions:\033[0m
2833
-h show this help text\n"
2934

35+
function fix-owns() {
36+
if [ -z "$1" ]; then
37+
docker-compose exec -u root -T fpm chown -R www:www /app
38+
else
39+
docker-compose exec -u root -T fpm chown -R www:www /app/"$1"
40+
fi
41+
}
42+
43+
function copy-to() {
44+
[ -z "$1" ] && echo "Please specify a directory or file to copy to container (ex. vendor, --all)" && exit
45+
46+
if [ "$1" == "--all" ]; then
47+
docker cp "./" "$(docker-compose ps -q fpm | awk '{print $1}')":/app/
48+
echo "Completed copying all files from host to container"
49+
fix-owns
50+
else
51+
if [ -f "../$1" ]; then
52+
docker cp "./${1}" "$(docker-compose ps -q fpm | awk '{print $1}')":/app/"$1"
53+
else
54+
docker cp "./${1}" "$(docker-compose ps -q fpm | awk '{print $1}')":/app/"$(dirname "$1")"
55+
fi
56+
echo "Completed copying $1 from host to container"
57+
fix-owns "$1"
58+
fi
59+
}
60+
61+
function copy-from() {
62+
[ -z "$1" ] && echo "Please specify a directory or file to copy from container (ex. vendor, --all)" && exit
63+
64+
if [ "$1" == "--all" ]; then
65+
docker cp "$(docker-compose ps -q fpm | awk '{print $1}')":/app/ "./"
66+
echo "Completed copying all files from container to host"
67+
else
68+
if [ -f "$1" ]; then
69+
docker cp "$(docker-compose ps -q fpm | awk '{print $1}')":/app/"$1" "./$1"
70+
else
71+
docker cp "$(docker-compose ps -q fpm | awk '{print $1}')":/app/"$1" "./$(dirname "$1")"
72+
fi
73+
echo "Completed copying $1 from container to host"
74+
fi
75+
}
76+
3077
if [ ${#@} -ne 0 ]; then
3178
for arg in "$@"; do
3279
if [ "${arg#"-h"}" = "" ]; then
3380
printf "$USAGE"
34-
exit 0;
81+
exit 0
3582
fi
3683
done
3784
fi;
@@ -40,12 +87,20 @@ case "$1" in
4087
pull)
4188
docker-compose pull
4289
;;
90+
init)
91+
read -p "Any existing data volumes will be removed. Are you sure? [y/N] " -r
92+
echo
93+
if [[ $REPLY =~ ^[Yy]$ ]]
94+
then
95+
docker-compose down --volumes
96+
docker-compose up --detach
97+
fi
98+
;;
4399
up)
44-
docker-compose down --volumes
45100
docker-compose up --detach
46101
;;
47102
down)
48-
docker-compose down --volumes
103+
docker-compose down
49104
;;
50105
bash)
51106
docker-compose run --rm deploy bash
@@ -86,7 +141,7 @@ case "$1" in
86141
version="$2"
87142
shift 2
88143
# allow ssh-agent forwarding for composer.json files that need access to private repos
89-
if [[ $(uname) = Darwin ]]; then
144+
if [[ $(uname) == Darwin ]]; then
90145
# https://docs.docker.com/docker-for-mac/osxfs/#ssh-agent-forwarding (D4M > 2.2)
91146
export SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock"
92147
fi
@@ -95,7 +150,17 @@ case "$1" in
95150
--mount "type=bind,src=$SSH_AUTH_SOCK,target=$SSH_AUTH_SOCK" -e SSH_AUTH_SOCK="$SSH_AUTH_SOCK" \
96151
"magento/magento-cloud-docker-php:${version}-cli-1.1" "$@"
97152
;;
153+
copy-to)
154+
copy-to $2
155+
;;
156+
copy-from)
157+
copy-from $2
158+
;;
159+
fix-owns)
160+
fix-owns
161+
;;
98162
*)
99163
printf "$USAGE"
100-
exit 0;
164+
exit 0
165+
;;
101166
esac

images/elasticsearch/6.8/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker.elastic.co/elasticsearch/elasticsearch:6.8.8
1+
FROM docker.elastic.co/elasticsearch/elasticsearch:6.8.15
22

33
RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml
44
RUN echo "discovery.type: single-node" >> /usr/share/elasticsearch/config/elasticsearch.yml

images/elasticsearch/7.11/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM docker.elastic.co/elasticsearch/elasticsearch:7.11.2
2+
3+
RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml
4+
RUN echo "discovery.type: single-node" >> /usr/share/elasticsearch/config/elasticsearch.yml
5+
RUN bin/elasticsearch-plugin install -b analysis-icu && \
6+
bin/elasticsearch-plugin install -b analysis-phonetic
7+
8+
ADD docker-healthcheck.sh /docker-healthcheck.sh
9+
ADD docker-entrypoint.sh /docker-entrypoint.sh
10+
11+
HEALTHCHECK --retries=3 CMD ["bash", "/docker-healthcheck.sh"]
12+
13+
ENTRYPOINT ["/docker-entrypoint.sh"]
14+
15+
EXPOSE 9200 9300
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
4+
if [[ -n "$ES_PLUGINS" ]]; then
5+
echo "Intalling plugins: $ES_PLUGNS"
6+
for PLUGIN in $ES_PLUGINS
7+
do
8+
./bin/elasticsearch-plugin install -b "$PLUGIN"
9+
done
10+
fi
11+
12+
/bin/bash /usr/local/bin/docker-entrypoint.sh
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
4+
if health="$(curl -fsSL "http://${ES_HOST:-elasticsearch}:${ES_PORT:-9200}/_cat/health?h=status")"; then
5+
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ")
6+
if [ "$health" = 'green' ] || [ "$health" = 'yellow' ]; then
7+
exit 0
8+
fi
9+
echo >&2 "Unexpected health status: $health"
10+
fi
11+
12+
exit 1

images/php/7.2-cli/Dockerfile

Lines changed: 13 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# This file is automatically generated. Do not edit directly. #
2-
FROM php:7.2-cli-buster
3-
ARG GOSU_VERSION=1.11
2+
FROM php:7.2-cli
3+
ARG COMPOSER_VERSION=1.10.22
44

55
ENV COMPOSER_MEMORY_LIMIT -1
66
ENV PHP_MEMORY_LIMIT 2G
77
ENV MAGENTO_ROOT /app
88
ENV DEBUG false
99
ENV MAGENTO_RUN_MODE production
10-
ENV UPDATE_UID_GID false
1110
ENV COMPOSER_ALLOW_SUPERUSER 1
11+
ENV COMPOSER_HOME /composer
1212
ENV ENABLE_SENDMAIL true
1313

1414
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
@@ -69,7 +69,7 @@ RUN pip3 install --upgrade setuptools \
6969
RUN npm install -g grunt-cli
7070

7171
# Install MailHog
72-
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
72+
RUN curl -L -O https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
7373
&& sudo chmod +x mhsendmail_linux_amd64 \
7474
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
7575

@@ -138,15 +138,15 @@ RUN curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire
138138
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
139139
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
140140
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
141-
&& apt-get remove libsodium* -y \
142-
&& mkdir -p /tmp/libsodium \
141+
&& apt-get remove libsodium* -y \
142+
&& mkdir -p /tmp/libsodium \
143143
&& curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
144144
&& cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
145145
&& ./configure \
146146
&& make && make check \
147-
&& make install \
147+
&& make install \
148148
&& cd / \
149-
&& rm -rf /tmp/libsodium \
149+
&& rm -rf /tmp/libsodium \
150150
&& pecl install -o -f libsodium
151151
RUN cd /tmp \
152152
&& curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
@@ -157,59 +157,14 @@ RUN cd /tmp \
157157
&& rm -rf ./ioncube \
158158
&& rm ioncube_loaders_lin_x86-64.tar.gz
159159

160-
RUN docker-php-ext-enable \
161-
bcmath \
162-
blackfire \
163-
bz2 \
164-
calendar \
165-
exif \
166-
gd \
167-
geoip \
168-
gettext \
169-
gmp \
170-
gnupg \
171-
igbinary \
172-
imagick \
173-
imap \
174-
intl \
175-
ldap \
176-
mailparse \
177-
msgpack \
178-
mysqli \
179-
oauth \
180-
opcache \
181-
pcov \
182-
pdo_mysql \
183-
propro \
184-
pspell \
185-
raphf \
186-
recode \
187-
redis \
188-
shmop \
189-
soap \
190-
sockets \
191-
sodium \
192-
ssh2 \
193-
sysvmsg \
194-
sysvsem \
195-
sysvshm \
196-
tidy \
197-
xdebug \
198-
xmlrpc \
199-
xsl \
200-
yaml \
201-
zip \
202-
pcntl \
203-
ioncube
204-
205160
ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
206161
ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
207162
ADD etc/php-pcov.ini /usr/local/etc/php/conf.d/zz-pcov-settings.ini
208163
ADD etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
209164
ADD etc/php-gnupg.ini /usr/local/etc/php/conf.d/gnupg.ini
210165

211166
# Get composer installed to /usr/local/bin/composer
212-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --version=1.10.16 --filename=composer
167+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --version=${COMPOSER_VERSION} --filename=composer
213168

214169
ADD bin/* /usr/local/bin/
215170

@@ -234,10 +189,12 @@ RUN mkdir -p ${MAGENTO_ROOT}
234189

235190
VOLUME ${MAGENTO_ROOT}
236191

237-
ENTRYPOINT ["/docker-entrypoint.sh"]
192+
RUN chown -R www:www /usr/local /var/www /var/log /usr/local/etc/php/conf.d ${MAGENTO_ROOT} /composer
238193

239-
USER root
194+
ENTRYPOINT ["/docker-entrypoint.sh"]
240195

241196
WORKDIR ${MAGENTO_ROOT}
242197

198+
USER root
199+
243200
CMD ["bash"]

0 commit comments

Comments
 (0)