Skip to content

Commit f13c1f9

Browse files
Merge pull request #144 from magento-commerce/php-8-4-docker-images
Add docker files for PHP 8.4
2 parents 628c349 + ad4b177 commit f13c1f9

27 files changed

+718
-6
lines changed

images/php/8.4-cli/Dockerfile

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# This file is automatically generated. Do not edit directly. #
2+
FROM golang:1.15 AS builder
3+
4+
RUN if [ $(uname -m) = "x86_64" ]; then mailhog_arch="amd64"; else mailhog_arch="arm64"; fi \
5+
&& wget -O mhsendmail.tar.gz https://github.com/mailhog/mhsendmail/archive/refs/tags/v0.2.0.tar.gz \
6+
&& tar -xf mhsendmail.tar.gz \
7+
&& mkdir -p ./src/github.com/mailhog/ \
8+
&& mv ./mhsendmail-0.2.0 ./src/github.com/mailhog/mhsendmail \
9+
&& cd ./src/github.com/mailhog/mhsendmail/ \
10+
&& go get . \
11+
&& GOOS=linux GOARCH=${mailhog_arch} go build -o mhsendmail .
12+
13+
FROM php:8.4-cli
14+
15+
ARG COMPOSER_VERSION=2.8.4
16+
ARG MAGENTO_ROOT=/app
17+
ARG COMPOSER_ALLOW_SUPERUSER=1
18+
ARG COMPOSER_HOME=/composer
19+
ARG CRONTAB=""
20+
21+
ENV COMPOSER_MEMORY_LIMIT=-1
22+
ENV COMPOSER_ALLOW_SUPERUSER=${COMPOSER_ALLOW_SUPERUSER}
23+
ENV COMPOSER_HOME=${COMPOSER_HOME}
24+
ENV COMPOSER_CLEAR_CACHE=false
25+
ENV PHP_MEMORY_LIMIT=-1
26+
ENV PHP_VALIDATE_TIMESTAMPS=1
27+
ENV DEBUG=false
28+
ENV MAGENTO_RUN_MODE=production
29+
ENV SENDMAIL_PATH=/dev/null
30+
ENV PHPRC=${MAGENTO_ROOT}/php.ini
31+
32+
ENV PHP_EXTENSIONS="\
33+
bcmath \
34+
bz2 \
35+
calendar \
36+
exif \
37+
gd \
38+
gettext \
39+
intl \
40+
mysqli \
41+
opcache \
42+
pdo_mysql \
43+
redis \
44+
soap \
45+
sockets \
46+
sodium \
47+
sysvmsg \
48+
sysvsem \
49+
sysvshm \
50+
xsl \
51+
zip \
52+
pcntl \
53+
ftp"
54+
55+
# Configure Node.js version
56+
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash
57+
58+
# Install dependencies
59+
RUN apt-get update \
60+
&& apt-get upgrade -y \
61+
&& apt-get install -y --no-install-recommends \
62+
apt-utils \
63+
cron \
64+
git \
65+
mariadb-client \
66+
nano \
67+
nodejs \
68+
python3 \
69+
python3-pip \
70+
redis-tools \
71+
sendmail-bin \
72+
sendmail \
73+
sudo \
74+
unzip \
75+
vim \
76+
openssh-client \
77+
gnupg2 \
78+
ca-certificates \
79+
lsb-release \
80+
software-properties-common \
81+
libbz2-dev \
82+
libjpeg62-turbo-dev \
83+
libpng-dev \
84+
libfreetype6-dev \
85+
libgmp-dev \
86+
libgpgme11-dev \
87+
libicu-dev \
88+
libldap2-dev \
89+
libpcre3-dev \
90+
libpspell-dev \
91+
libtidy-dev \
92+
libxslt1-dev \
93+
libyaml-dev \
94+
libzip-dev \
95+
zip \
96+
python3-yaml \
97+
&& rm -rf /var/lib/apt/lists/*
98+
99+
# Install Python packages
100+
101+
102+
# Install Grunt
103+
RUN npm install -g grunt-cli
104+
105+
# Install MailHog
106+
COPY --from=builder /go/src/github.com/mailhog/mhsendmail/mhsendmail /usr/local/bin/
107+
RUN sudo chmod +x /usr/local/bin/mhsendmail
108+
109+
# Configure the gd library
110+
RUN docker-php-ext-configure \
111+
gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
112+
RUN docker-php-ext-configure \
113+
opcache --enable-opcache
114+
115+
# Install required PHP extensions
116+
RUN docker-php-ext-install -j$(nproc) \
117+
bcmath \
118+
bz2 \
119+
calendar \
120+
exif \
121+
gd \
122+
gettext \
123+
gmp \
124+
intl \
125+
mysqli \
126+
opcache \
127+
pdo_mysql \
128+
shmop \
129+
soap \
130+
sockets \
131+
sysvmsg \
132+
sysvsem \
133+
sysvshm \
134+
tidy \
135+
xsl \
136+
zip \
137+
pcntl \
138+
ftp
139+
140+
RUN pecl install -o -f \
141+
gnupg \
142+
mailparse \
143+
msgpack \
144+
oauth \
145+
pcov \
146+
raphf \
147+
redis \
148+
xdebug-3.4.0 \
149+
xmlrpc-1.0.0RC3 \
150+
yaml \
151+
pspell
152+
153+
RUN curl -L https://packages.blackfire.io/gpg.key | gpg --dearmor > blackfire.io-archive-keyring.gpg \
154+
&& install -o root -g root -m 644 blackfire.io-archive-keyring.gpg /etc/apt/trusted.gpg.d/ \
155+
&& echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list \
156+
&& apt-get update \
157+
&& apt-get install blackfire-php \
158+
&& rm -rf /var/lib/apt/lists/*
159+
RUN if [ $(uname -m) = "x86_64" ]; then ldap_arch="x86_64-linux-gnu"; else ldap_arch="aarch64-linux-gnu"; fi \
160+
&& docker-php-ext-configure ldap --with-libdir=lib/${ldap_arch}
161+
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
162+
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
163+
&& apt-get remove libsodium* -y \
164+
&& mkdir -p /tmp/libsodium \
165+
&& curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
166+
&& cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
167+
&& ./configure \
168+
&& make && make check \
169+
&& make install \
170+
&& cd / \
171+
&& rm -rf /tmp/libsodium \
172+
&& pecl install -o -f libsodium
173+
174+
ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
175+
ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
176+
ADD etc/php-pcov.ini /usr/local/etc/php/conf.d/zz-pcov-settings.ini
177+
ADD etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
178+
ADD etc/php-gnupg.ini /usr/local/etc/php/conf.d/gnupg.ini
179+
180+
# Get composer installed to /usr/local/bin/composer
181+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --version=${COMPOSER_VERSION} --filename=composer
182+
183+
ADD bin/* /usr/local/bin/
184+
185+
RUN groupadd -g 1000 www && useradd -g 1000 -u 1000 -d ${MAGENTO_ROOT} -s /bin/bash www
186+
187+
ADD docker-entrypoint.sh /docker-entrypoint.sh
188+
189+
RUN ["chmod", "+x", \
190+
"/docker-entrypoint.sh", \
191+
"/usr/local/bin/magento-installer", \
192+
"/usr/local/bin/magento-command", \
193+
"/usr/local/bin/mftf-command", \
194+
"/usr/local/bin/ece-command", \
195+
"/usr/local/bin/cloud-build", \
196+
"/usr/local/bin/cloud-deploy", \
197+
"/usr/local/bin/cloud-post-deploy", \
198+
"/usr/local/bin/run-cron", \
199+
"/usr/local/bin/run-hooks" \
200+
]
201+
202+
RUN mkdir -p ${MAGENTO_ROOT}
203+
204+
VOLUME ${MAGENTO_ROOT}
205+
206+
RUN chown -R www:www /usr/local /var/www /var/log /usr/local/etc/php/conf.d /etc/cron.d ${MAGENTO_ROOT} ${COMPOSER_HOME}
207+
RUN if [ ! -z "${CRONTAB}" ]; then echo "${CRONTAB}" > /etc/cron.d/magento && touch /var/log/cron.log ; fi
208+
209+
ENTRYPOINT ["/docker-entrypoint.sh"]
210+
211+
WORKDIR ${MAGENTO_ROOT}
212+
213+
USER root
214+
215+
CMD ["bash"]

images/php/8.4-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.4-cli/bin/cloud-deploy

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
# set developer mode if it is configured in $MAGENTO_RUN_MODE
27+
if [ "$MAGENTO_RUN_MODE" == "developer" ]; then
28+
output=$(magento-command deploy:mode:set developer)
29+
if [[ $output == *"Enabled developer mode."* ]]; then
30+
echo "Enabled developer mode."
31+
else
32+
echo $output
33+
fi
34+
fi
35+
36+
37+
echo "Deployment finished."
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
[ "$DEBUG" = "true" ] && set -x
6+
7+
echo "Running \"post-deploy\" hook."
8+
9+
run-hooks post_deploy
10+
11+
echo "Post deployment finished."

images/php/8.4-cli/bin/ece-command

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
[ "$DEBUG" = "true" ] && set -x
4+
5+
ECE_COMMAND="$MAGENTO_ROOT/vendor/bin/ece-tools"
6+
7+
exec $ECE_COMMAND "$@"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
[ "$DEBUG" = "true" ] && set -x
4+
5+
MAGENTO_COMMAND="php $MAGENTO_ROOT/bin/magento"
6+
7+
exec $MAGENTO_COMMAND "$@"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
[ "$DEBUG" = "true" ] && set -x
6+
7+
BUILD_COMMAND="cloud-build"
8+
DEPLOY_COMMAND="cloud-deploy"
9+
10+
$BUILD_COMMAND
11+
$DEPLOY_COMMAND

images/php/8.4-cli/bin/mftf-command

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
[ "$DEBUG" = "true" ] && set -x
4+
5+
MFTF_COMMAND="$MAGENTO_ROOT/vendor/bin/mftf"
6+
7+
exec $MFTF_COMMAND "$@"

images/php/8.4-cli/bin/run-cron

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
cron && tail -f -n0 /var/log/cron.log

0 commit comments

Comments
 (0)