Skip to content

Commit 3b43577

Browse files
authored
Merge pull request #22 from magento-commerce/imported-magento-magento-cloud-docker-298
2 parents d8aad29 + a8f8191 commit 3b43577

File tree

13 files changed

+35
-35
lines changed

13 files changed

+35
-35
lines changed

images/php/7.2-fpm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ENV MAGENTO_RUN_MODE production
99
ENV UPLOAD_MAX_FILESIZE 64M
1010
ENV UPDATE_UID_GID false
1111
ENV ENABLE_SENDMAIL true
12-
ENV SET_DOCKER_HOST false
1312

1413
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
1514

@@ -21,6 +20,7 @@ RUN apt-get update \
2120
sendmail-bin \
2221
sendmail \
2322
sudo \
23+
iproute2 \
2424
libbz2-dev \
2525
libjpeg62-turbo-dev \
2626
libpng-dev \

images/php/7.2-fpm/docker-entrypoint.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ fi
6161
# Configure PHP-FPM
6262
[ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf
6363

64-
# Set host.docker.inernal for LINUX os
65-
if [[ "$SET_DOCKER_HOST" = "true" ]]; then
66-
apt update
67-
apt install -y iproute2
68-
echo -e "`/sbin/ip route|awk '/default/ { print $3 }'`\thost.docker.internal" | sudo tee -a /etc/hosts > /dev/null
64+
# Set host.docker.inernal if not available
65+
HOST_NAME="host.docker.internal"
66+
HOST_IP=$(php -r "putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1'); echo gethostbyname('$HOST_NAME');")
67+
if [[ "$HOST_IP" == "$HOST_NAME" ]]; then
68+
HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
69+
printf "\n%s %s\n" "$HOST_IP" "$HOST_NAME" >> /etc/hosts
6970
fi
7071

7172
exec "$@"

images/php/7.3-fpm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ENV MAGENTO_RUN_MODE production
99
ENV UPLOAD_MAX_FILESIZE 64M
1010
ENV UPDATE_UID_GID false
1111
ENV ENABLE_SENDMAIL true
12-
ENV SET_DOCKER_HOST false
1312

1413
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
1514

@@ -21,6 +20,7 @@ RUN apt-get update \
2120
sendmail-bin \
2221
sendmail \
2322
sudo \
23+
iproute2 \
2424
libbz2-dev \
2525
libjpeg62-turbo-dev \
2626
libpng-dev \

images/php/7.3-fpm/docker-entrypoint.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ fi
6161
# Configure PHP-FPM
6262
[ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf
6363

64-
# Set host.docker.inernal for LINUX os
65-
if [[ "$SET_DOCKER_HOST" = "true" ]]; then
66-
apt update
67-
apt install -y iproute2
68-
echo -e "`/sbin/ip route|awk '/default/ { print $3 }'`\thost.docker.internal" | sudo tee -a /etc/hosts > /dev/null
64+
# Set host.docker.inernal if not available
65+
HOST_NAME="host.docker.internal"
66+
HOST_IP=$(php -r "putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1'); echo gethostbyname('$HOST_NAME');")
67+
if [[ "$HOST_IP" == "$HOST_NAME" ]]; then
68+
HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
69+
printf "\n%s %s\n" "$HOST_IP" "$HOST_NAME" >> /etc/hosts
6970
fi
7071

7172
exec "$@"

images/php/7.4-fpm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ENV MAGENTO_RUN_MODE production
99
ENV UPLOAD_MAX_FILESIZE 64M
1010
ENV UPDATE_UID_GID false
1111
ENV ENABLE_SENDMAIL true
12-
ENV SET_DOCKER_HOST false
1312

1413
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
1514

@@ -21,6 +20,7 @@ RUN apt-get update \
2120
sendmail-bin \
2221
sendmail \
2322
sudo \
23+
iproute2 \
2424
libbz2-dev \
2525
libjpeg62-turbo-dev \
2626
libpng-dev \

images/php/7.4-fpm/docker-entrypoint.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ fi
6161
# Configure PHP-FPM
6262
[ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf
6363

64-
# Set host.docker.inernal for LINUX os
65-
if [[ "$SET_DOCKER_HOST" = "true" ]]; then
66-
apt update
67-
apt install -y iproute2
68-
echo -e "`/sbin/ip route|awk '/default/ { print $3 }'`\thost.docker.internal" | sudo tee -a /etc/hosts > /dev/null
64+
# Set host.docker.inernal if not available
65+
HOST_NAME="host.docker.internal"
66+
HOST_IP=$(php -r "putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1'); echo gethostbyname('$HOST_NAME');")
67+
if [[ "$HOST_IP" == "$HOST_NAME" ]]; then
68+
HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
69+
printf "\n%s %s\n" "$HOST_IP" "$HOST_NAME" >> /etc/hosts
6970
fi
7071

7172
exec "$@"

images/php/fpm/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ENV MAGENTO_RUN_MODE production
99
ENV UPLOAD_MAX_FILESIZE 64M
1010
ENV UPDATE_UID_GID false
1111
ENV ENABLE_SENDMAIL true
12-
ENV SET_DOCKER_HOST false
1312

1413
{%env_php_extensions%}
1514

images/php/fpm/docker-entrypoint.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ fi
6161
# Configure PHP-FPM
6262
[ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf
6363

64-
# Set host.docker.inernal for LINUX os
65-
if [[ "$SET_DOCKER_HOST" = "true" ]]; then
66-
apt update
67-
apt install -y iproute2
68-
echo -e "`/sbin/ip route|awk '/default/ { print $3 }'`\thost.docker.internal" | sudo tee -a /etc/hosts > /dev/null
64+
# Set host.docker.inernal if not available
65+
HOST_NAME="host.docker.internal"
66+
HOST_IP=$(php -r "putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1'); echo gethostbyname('$HOST_NAME');")
67+
if [[ "$HOST_IP" == "$HOST_NAME" ]]; then
68+
HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
69+
printf "\n%s %s\n" "$HOST_IP" "$HOST_NAME" >> /etc/hosts
6970
fi
7071

7172
exec "$@"

src/Command/BuildCompose.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ protected function configure(): void
187187
Source\CliSource::OPTION_SET_DOCKER_HOST_XDEBUG,
188188
null,
189189
InputOption::VALUE_NONE,
190-
'Sets host.docker.internal for fpm_xdebug container to resolve debug issue for LINUX system'
190+
'Deprecated option to resolve host.docker.internal on Linux. Did nothing at the moment'
191191
)->addOption(
192192
Source\CliSource::OPTION_NGINX_WORKER_PROCESSES,
193193
null,

src/Command/Image/GeneratePhp.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class GeneratePhp extends Command
3636
'apt-utils',
3737
'sendmail-bin',
3838
'sendmail',
39-
'sudo'
39+
'sudo',
40+
'iproute2'
4041
];
4142
private const DEFAULT_PACKAGES_PHP_CLI = [
4243
'apt-utils',

0 commit comments

Comments
 (0)