Skip to content

Commit c732075

Browse files
authored
MCLOUD-7941: Add PHP 8.0 to Magento Cloud Docker (#49)
1 parent 1afec7f commit c732075

Some content is hidden

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

42 files changed

+848
-11
lines changed

dist/bin/magento-docker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ USAGE="Magento Cloud Docker
2424
php 7.2 run a command in a PHP 7.2 container
2525
php 7.3 run a command in a PHP 7.3 container
2626
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
2728
copy-to copy to container (use --all or specific file/directory)
2829
copy-from copy from container (use --all or specific file/directory)
2930
fix-owns fix ownership to www:www

images/php/7.2-cli/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

images/php/7.2-fpm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ RUN apt-get update \
4646
&& rm -rf /var/lib/apt/lists/*
4747

4848
# Install MailHog
49-
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
49+
RUN curl -L -O https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
5050
&& sudo chmod +x mhsendmail_linux_amd64 \
5151
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
5252

images/php/7.3-cli/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ RUN pip3 install --upgrade setuptools \
6767
RUN npm install -g grunt-cli
6868

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

images/php/7.3-fpm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ RUN apt-get update \
4444
&& rm -rf /var/lib/apt/lists/*
4545

4646
# Install MailHog
47-
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
47+
RUN curl -L -O https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
4848
&& sudo chmod +x mhsendmail_linux_amd64 \
4949
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
5050

images/php/7.4-cli/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ RUN pip3 install --upgrade setuptools \
6363
RUN npm install -g grunt-cli
6464

6565
# Install MailHog
66-
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
66+
RUN curl -L -O https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
6767
&& sudo chmod +x mhsendmail_linux_amd64 \
6868
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
6969

images/php/7.4-fpm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ RUN apt-get update \
4040
&& rm -rf /var/lib/apt/lists/*
4141

4242
# Install MailHog
43-
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
43+
RUN curl -L -O https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
4444
&& sudo chmod +x mhsendmail_linux_amd64 \
4545
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
4646

images/php/8.0-cli/Dockerfile

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# This file is automatically generated. Do not edit directly. #
2+
FROM php:8.0-cli
3+
ARG COMPOSER_VERSION=1.10.22
4+
5+
ENV COMPOSER_MEMORY_LIMIT -1
6+
ENV PHP_MEMORY_LIMIT 2G
7+
ENV MAGENTO_ROOT /app
8+
ENV DEBUG false
9+
ENV MAGENTO_RUN_MODE production
10+
ENV COMPOSER_ALLOW_SUPERUSER 1
11+
ENV COMPOSER_HOME /composer
12+
ENV ENABLE_SENDMAIL true
13+
14+
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
15+
16+
# Configure Node.js version
17+
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash
18+
19+
# Install dependencies
20+
RUN apt-get update \
21+
&& apt-get upgrade -y \
22+
&& apt-get install -y --no-install-recommends \
23+
apt-utils \
24+
cron \
25+
git \
26+
mariadb-client \
27+
nano \
28+
nodejs \
29+
python3 \
30+
python3-pip \
31+
redis-tools \
32+
sendmail-bin \
33+
sendmail \
34+
sudo \
35+
unzip \
36+
vim \
37+
openssh-client \
38+
libbz2-dev \
39+
libjpeg62-turbo-dev \
40+
libpng-dev \
41+
libfreetype6-dev \
42+
libgmp-dev \
43+
libgpgme11-dev \
44+
libicu-dev \
45+
libldap2-dev \
46+
libpcre3-dev \
47+
libpspell-dev \
48+
libtidy-dev \
49+
libxslt1-dev \
50+
libyaml-dev \
51+
libzip-dev \
52+
zip \
53+
&& rm -rf /var/lib/apt/lists/*
54+
55+
# Install PyYAML
56+
RUN pip3 install --upgrade setuptools \
57+
&& pip3 install pyyaml
58+
59+
# Install Grunt
60+
RUN npm install -g grunt-cli
61+
62+
# Install MailHog
63+
RUN curl -L -O https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
64+
&& sudo chmod +x mhsendmail_linux_amd64 \
65+
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
66+
67+
# Configure the gd library
68+
RUN docker-php-ext-configure \
69+
gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
70+
RUN docker-php-ext-configure \
71+
ldap --with-libdir=lib/x86_64-linux-gnu
72+
RUN docker-php-ext-configure \
73+
opcache --enable-opcache
74+
75+
# Install required PHP extensions
76+
RUN docker-php-ext-install -j$(nproc) \
77+
bcmath \
78+
bz2 \
79+
calendar \
80+
exif \
81+
gd \
82+
gettext \
83+
gmp \
84+
intl \
85+
ldap \
86+
mysqli \
87+
opcache \
88+
pdo_mysql \
89+
pspell \
90+
shmop \
91+
soap \
92+
sockets \
93+
sysvmsg \
94+
sysvsem \
95+
sysvshm \
96+
tidy \
97+
xsl \
98+
zip \
99+
pcntl
100+
101+
RUN pecl install -o -f \
102+
gnupg \
103+
mailparse \
104+
msgpack \
105+
oauth \
106+
pcov \
107+
raphf \
108+
redis \
109+
xdebug-3.0.4 \
110+
xmlrpc-1.0.0RC2 \
111+
yaml
112+
113+
RUN curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
114+
&& mkdir -p /tmp/blackfire \
115+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
116+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
117+
&& echo blackfire.agent_socket=tcp://blackfire:8707 > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
118+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
119+
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
120+
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
121+
&& apt-get remove libsodium* -y \
122+
&& mkdir -p /tmp/libsodium \
123+
&& curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
124+
&& cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
125+
&& ./configure \
126+
&& make && make check \
127+
&& make install \
128+
&& cd / \
129+
&& rm -rf /tmp/libsodium \
130+
&& pecl install -o -f libsodium
131+
132+
ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
133+
ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
134+
ADD etc/php-pcov.ini /usr/local/etc/php/conf.d/zz-pcov-settings.ini
135+
ADD etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
136+
ADD etc/php-gnupg.ini /usr/local/etc/php/conf.d/gnupg.ini
137+
138+
# Get composer installed to /usr/local/bin/composer
139+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --version=${COMPOSER_VERSION} --filename=composer
140+
141+
ADD bin/* /usr/local/bin/
142+
143+
RUN groupadd -g 1000 www && useradd -g 1000 -u 1000 -d ${MAGENTO_ROOT} -s /bin/bash www
144+
145+
ADD docker-entrypoint.sh /docker-entrypoint.sh
146+
147+
RUN ["chmod", "+x", \
148+
"/docker-entrypoint.sh", \
149+
"/usr/local/bin/magento-installer", \
150+
"/usr/local/bin/magento-command", \
151+
"/usr/local/bin/mftf-command", \
152+
"/usr/local/bin/ece-command", \
153+
"/usr/local/bin/cloud-build", \
154+
"/usr/local/bin/cloud-deploy", \
155+
"/usr/local/bin/cloud-post-deploy", \
156+
"/usr/local/bin/run-cron", \
157+
"/usr/local/bin/run-hooks" \
158+
]
159+
160+
RUN mkdir -p ${MAGENTO_ROOT}
161+
162+
VOLUME ${MAGENTO_ROOT}
163+
164+
RUN chown -R www:www /usr/local /var/www /var/log /usr/local/etc/php/conf.d ${MAGENTO_ROOT} /composer
165+
166+
ENTRYPOINT ["/docker-entrypoint.sh"]
167+
168+
WORKDIR ${MAGENTO_ROOT}
169+
170+
USER root
171+
172+
CMD ["bash"]

images/php/8.0-cli/bin/cloud-build

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
[ "$DEBUG" = "true" ] && set -x
6+
7+
RUN_HOOKS="run-hooks"
8+
9+
if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10+
echo "Cleaning directories:"
11+
12+
if [ "$INSTALLATION_TYPE" == "composer" ]; then
13+
echo "Cleaning setup directory."
14+
rm -rf $MAGENTO_ROOT/setup/*
15+
fi
16+
17+
echo "Cleaning vendor directory."
18+
rm -rf $MAGENTO_ROOT/vendor/*
19+
20+
echo "Cleaning generated directory."
21+
rm -rf $MAGENTO_ROOT/generated/*
22+
23+
echo "Removing app/etc/env.php file"
24+
rm -f $MAGENTO_ROOT/app/etc/env.php
25+
fi
26+
27+
echo "Installing dependencies."
28+
29+
composer --working-dir=$MAGENTO_ROOT install --no-suggest --no-ansi --no-interaction --no-progress --prefer-dist
30+
31+
echo "Running \"build\" hook."
32+
33+
$RUN_HOOKS build
34+
35+
if [ "$MAGENTO_RUN_MODE" == "production" ]; then
36+
echo "Setting file permissions."
37+
38+
chown -R www:www $MAGENTO_ROOT
39+
40+
find $MAGENTO_ROOT/pub -type f -exec chmod 664 {} \;
41+
find $MAGENTO_ROOT/pub -type d -exec chmod 775 {} \;
42+
fi
43+
44+
echo "Building complete."

images/php/8.0-cli/bin/cloud-deploy

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
[ "$DEBUG" = "true" ] && set -x
6+
7+
echo "Running \"deploy\" hook."
8+
9+
run-hooks deploy
10+
11+
# check that Varnish exists
12+
if ( varnish=$(curl -I varnish 2>&1 | grep -i "magento2") ); then
13+
minor_magento_version=$(magento-command --version | sed "s/Magento CLI version \([0-9]*\.[0-9]*\).*/\1/")
14+
if [[ "$minor_magento_version" != "2.1" ]]; then
15+
output=$(magento-command config:set system/full_page_cache/caching_application 2)
16+
# as config:set does not return error code, we check output text to continue set varnish settings
17+
if [[ $output == *"Value was saved"* ]]; then
18+
echo "Setting Varnish for Magento FPC."
19+
magento-command setup:config:set --http-cache-hosts=varnish -n
20+
else
21+
echo $output
22+
fi
23+
fi
24+
fi
25+
26+
27+
echo "Deployment finished."

0 commit comments

Comments
 (0)