Skip to content

Commit

Permalink
Merge pull request magento#98 from magento-commerce/develop
Browse files Browse the repository at this point in the history
MCLOUD-9275: Cloud Tools Release
  • Loading branch information
BaDos committed Sep 9, 2022
2 parents 1d4bd41 + 71bd086 commit 9d84dcf
Show file tree
Hide file tree
Showing 38 changed files with 429 additions and 212 deletions.
15 changes: 11 additions & 4 deletions bin/init-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,20 @@ parse_bool_flag()
esac
}

version_is_valid()
php_version_is_valid()
{
if [[ ! $OPTARG =~ ^[0-9]+\.[0-9]+$ ]]; then
die "Invalid version number $OPTARG for $OPT"
fi
}

image_version_is_valid()
{
if [[ ! $OPTARG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
die "Invalid version number $OPTARG for $OPT"
fi
}

domain_is_valid()
{
# Check that a flag isn't being interpreted as the domain
Expand All @@ -70,7 +77,7 @@ add_host()
}

PHP_VERSION="7.4"
IMAGE_VERSION="1.2.1"
IMAGE_VERSION="1.3.2"
ADD_HOST=true
DOMAIN="magento2.docker"
USAGE="Init Docker
Expand Down Expand Up @@ -100,13 +107,13 @@ while getopts "hp:i:-:" OPT; do
case "$OPT" in
p | php )
needs_arg "$@"
version_is_valid
php_version_is_valid
PHP_VERSION="$OPTARG"
;;

i | image )
needs_arg "$@"
version_is_valid
image_version_is_valid
IMAGE_VERSION="$OPTARG"
;;

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/magento-cloud-docker",
"description": "Magento Cloud Docker",
"type": "magento2-component",
"version": "1.3.2",
"version": "1.3.3",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
29 changes: 29 additions & 0 deletions images/mailhog/1.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# MailHog Dockerfile
#

FROM golang:1.17.9-alpine

# Install MailHog:
RUN apk --no-cache add --virtual build-dependencies \
git \
&& mkdir -p /root/gocode \
&& export GOPATH=/root/gocode \
&& go get github.com/mailhog/MailHog@v1.0.1 \
&& mv /root/gocode/bin/MailHog /usr/local/bin \
&& rm -rf /root/gocode \
&& apk del --purge build-dependencies

# Add mailhog user/group with uid/gid 1000.
# This is a workaround for boot2docker issue #581, see
# https://github.com/boot2docker/boot2docker/issues/581
RUN adduser -D -u 1000 mailhog

USER mailhog

WORKDIR /home/mailhog

ENTRYPOINT ["MailHog"]

# Expose the SMTP and HTTP ports:
EXPOSE 1025 8025
46 changes: 30 additions & 16 deletions images/php/7.2-cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# This file is automatically generated. Do not edit directly. #
FROM golang:1.15 AS builder

RUN if [ $(uname -m) = "x86_64" ]; then mailhog_arch="amd64"; else mailhog_arch="arm64"; fi \
&& wget -O mhsendmail.tar.gz https://github.com/mailhog/mhsendmail/archive/refs/tags/v0.2.0.tar.gz \
&& tar -xf mhsendmail.tar.gz \
&& mkdir -p ./src/github.com/mailhog/ \
&& mv ./mhsendmail-0.2.0 ./src/github.com/mailhog/mhsendmail \
&& cd ./src/github.com/mailhog/mhsendmail/ \
&& go get . \
&& GOOS=linux GOARCH=${mailhog_arch} go build -o mhsendmail .

FROM php:7.2-cli

ARG COMPOSER_VERSION=1.10.22
Expand Down Expand Up @@ -41,6 +52,10 @@ RUN apt-get update \
unzip \
vim \
openssh-client \
gnupg2 \
ca-certificates \
lsb-release \
software-properties-common \
libbz2-dev \
libjpeg62-turbo-dev \
libpng-dev \
Expand Down Expand Up @@ -75,17 +90,14 @@ RUN pip3 install --upgrade setuptools \
RUN npm install -g grunt-cli

# Install MailHog
RUN curl -L -O https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
&& sudo chmod +x mhsendmail_linux_amd64 \
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
COPY --from=builder /go/src/github.com/mailhog/mhsendmail/mhsendmail /usr/local/bin/
RUN sudo chmod +x /usr/local/bin/mhsendmail

# Configure the gd library
RUN docker-php-ext-configure \
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-configure \
imap --with-kerberos --with-imap-ssl
RUN docker-php-ext-configure \
ldap --with-libdir=lib/x86_64-linux-gnu
RUN docker-php-ext-configure \
opcache --enable-opcache
RUN docker-php-ext-configure \
Expand All @@ -102,7 +114,6 @@ RUN docker-php-ext-install -j$(nproc) \
gmp \
imap \
intl \
ldap \
mysqli \
opcache \
pdo_mysql \
Expand Down Expand Up @@ -136,12 +147,14 @@ RUN pecl install -o -f \
xdebug-3.1.2 \
yaml

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;") \
&& mkdir -p /tmp/blackfire \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
&& echo blackfire.agent_socket=tcp://blackfire:8707 > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
RUN curl -L https://packages.blackfire.io/gpg.key | gpg --dearmor > blackfire.io-archive-keyring.gpg \
&& install -o root -g root -m 644 blackfire.io-archive-keyring.gpg /etc/apt/trusted.gpg.d/ \
&& echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list \
&& apt-get update \
&& apt-get install blackfire-php \
&& rm -rf /var/lib/apt/lists/*
RUN if [ $(uname -m) = "x86_64" ]; then ldap_arch="x86_64-linux-gnu"; else ldap_arch="aarch64-linux-gnu"; fi \
&& docker-php-ext-configure ldap --with-libdir=lib/${ldap_arch}
RUN mkdir -p /tmp/zoo \
&& cd /tmp/zoo \
&& git clone https://github.com/php-zookeeper/php-zookeeper.git \
Expand Down Expand Up @@ -172,13 +185,14 @@ RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
&& rm -rf /tmp/libsodium \
&& pecl install -o -f libsodium
RUN cd /tmp \
&& curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar zxvf ioncube_loaders_lin_x86-64.tar.gz \
&& if [ $(uname -m) = "x86_64" ]; then ioncube_arch="x86-64"; else ioncube_arch="aarch64"; fi \
&& curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_${ioncube_arch}.tar.gz \
&& tar zxvf ioncube_loaders_lin_${ioncube_arch}.tar.gz \
&& export PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") \
&& export PHP_EXT_DIR=$(php-config --extension-dir) \
&& cp "./ioncube/ioncube_loader_lin_${PHP_VERSION}.so" "${PHP_EXT_DIR}/ioncube.so" \
&& rm -rf ./ioncube \
&& rm ioncube_loaders_lin_x86-64.tar.gz
&& rm ioncube_loaders_lin_${ioncube_arch}.tar.gz

ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
Expand Down Expand Up @@ -213,7 +227,7 @@ RUN mkdir -p ${MAGENTO_ROOT}
VOLUME ${MAGENTO_ROOT}

RUN chown -R www:www /usr/local /var/www /var/log /usr/local/etc/php/conf.d /etc/cron.d ${MAGENTO_ROOT} ${COMPOSER_HOME}
RUN if [[ ! -z "${CRONTAB}" ]]; then echo "${CRONTAB}" > /etc/cron.d/magento && touch /var/log/cron.log ; fi
RUN if [ ! -z "${CRONTAB}" ]; then echo "${CRONTAB}" > /etc/cron.d/magento && touch /var/log/cron.log ; fi

ENTRYPOINT ["/docker-entrypoint.sh"]

Expand Down
44 changes: 29 additions & 15 deletions images/php/7.2-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# This file is automatically generated. Do not edit directly. #
FROM golang:1.15 AS builder

RUN if [ $(uname -m) = "x86_64" ]; then mailhog_arch="amd64"; else mailhog_arch="arm64"; fi \
&& wget -O mhsendmail.tar.gz https://github.com/mailhog/mhsendmail/archive/refs/tags/v0.2.0.tar.gz \
&& tar -xf mhsendmail.tar.gz \
&& mkdir -p ./src/github.com/mailhog/ \
&& mv ./mhsendmail-0.2.0 ./src/github.com/mailhog/mhsendmail \
&& cd ./src/github.com/mailhog/mhsendmail/ \
&& go get . \
&& GOOS=linux GOARCH=${mailhog_arch} go build -o mhsendmail .

FROM php:7.2-fpm

ARG MAGENTO_ROOT=/app
Expand All @@ -23,6 +34,10 @@ RUN apt-get update \
sudo \
iproute2 \
git \
gnupg2 \
ca-certificates \
lsb-release \
software-properties-common \
libbz2-dev \
libjpeg62-turbo-dev \
libpng-dev \
Expand Down Expand Up @@ -50,17 +65,14 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# Install MailHog
RUN curl -L -O https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
&& sudo chmod +x mhsendmail_linux_amd64 \
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
COPY --from=builder /go/src/github.com/mailhog/mhsendmail/mhsendmail /usr/local/bin/
RUN sudo chmod +x /usr/local/bin/mhsendmail

# Configure the gd library
RUN docker-php-ext-configure \
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-configure \
imap --with-kerberos --with-imap-ssl
RUN docker-php-ext-configure \
ldap --with-libdir=lib/x86_64-linux-gnu
RUN docker-php-ext-configure \
opcache --enable-opcache
RUN docker-php-ext-configure \
Expand All @@ -77,7 +89,6 @@ RUN docker-php-ext-install -j$(nproc) \
gmp \
imap \
intl \
ldap \
mysqli \
opcache \
pdo_mysql \
Expand Down Expand Up @@ -111,12 +122,14 @@ RUN pecl install -o -f \
xdebug-3.1.2 \
yaml

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;") \
&& mkdir -p /tmp/blackfire \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
&& echo blackfire.agent_socket=tcp://blackfire:8707 > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
RUN curl -L https://packages.blackfire.io/gpg.key | gpg --dearmor > blackfire.io-archive-keyring.gpg \
&& install -o root -g root -m 644 blackfire.io-archive-keyring.gpg /etc/apt/trusted.gpg.d/ \
&& echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list \
&& apt-get update \
&& apt-get install blackfire-php \
&& rm -rf /var/lib/apt/lists/*
RUN if [ $(uname -m) = "x86_64" ]; then ldap_arch="x86_64-linux-gnu"; else ldap_arch="aarch64-linux-gnu"; fi \
&& docker-php-ext-configure ldap --with-libdir=lib/${ldap_arch}
RUN mkdir -p /tmp/zoo \
&& cd /tmp/zoo \
&& git clone https://github.com/php-zookeeper/php-zookeeper.git \
Expand Down Expand Up @@ -147,13 +160,14 @@ RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
&& rm -rf /tmp/libsodium \
&& pecl install -o -f libsodium
RUN cd /tmp \
&& curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar zxvf ioncube_loaders_lin_x86-64.tar.gz \
&& if [ $(uname -m) = "x86_64" ]; then ioncube_arch="x86-64"; else ioncube_arch="aarch64"; fi \
&& curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_${ioncube_arch}.tar.gz \
&& tar zxvf ioncube_loaders_lin_${ioncube_arch}.tar.gz \
&& export PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") \
&& export PHP_EXT_DIR=$(php-config --extension-dir) \
&& cp "./ioncube/ioncube_loader_lin_${PHP_VERSION}.so" "${PHP_EXT_DIR}/ioncube.so" \
&& rm -rf ./ioncube \
&& rm ioncube_loaders_lin_x86-64.tar.gz
&& rm ioncube_loaders_lin_${ioncube_arch}.tar.gz

COPY etc/php-fpm.ini /usr/local/etc/php/conf.d/zz-magento.ini
COPY etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
Expand Down
46 changes: 30 additions & 16 deletions images/php/7.3-cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# This file is automatically generated. Do not edit directly. #
FROM golang:1.15 AS builder

RUN if [ $(uname -m) = "x86_64" ]; then mailhog_arch="amd64"; else mailhog_arch="arm64"; fi \
&& wget -O mhsendmail.tar.gz https://github.com/mailhog/mhsendmail/archive/refs/tags/v0.2.0.tar.gz \
&& tar -xf mhsendmail.tar.gz \
&& mkdir -p ./src/github.com/mailhog/ \
&& mv ./mhsendmail-0.2.0 ./src/github.com/mailhog/mhsendmail \
&& cd ./src/github.com/mailhog/mhsendmail/ \
&& go get . \
&& GOOS=linux GOARCH=${mailhog_arch} go build -o mhsendmail .

FROM php:7.3-cli

ARG COMPOSER_VERSION=1.10.22
Expand Down Expand Up @@ -41,6 +52,10 @@ RUN apt-get update \
unzip \
vim \
openssh-client \
gnupg2 \
ca-certificates \
lsb-release \
software-properties-common \
libbz2-dev \
libjpeg62-turbo-dev \
libpng-dev \
Expand Down Expand Up @@ -73,17 +88,14 @@ RUN pip3 install --upgrade setuptools \
RUN npm install -g grunt-cli

# Install MailHog
RUN curl -L -O https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
&& sudo chmod +x mhsendmail_linux_amd64 \
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
COPY --from=builder /go/src/github.com/mailhog/mhsendmail/mhsendmail /usr/local/bin/
RUN sudo chmod +x /usr/local/bin/mhsendmail

# Configure the gd library
RUN docker-php-ext-configure \
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-configure \
imap --with-kerberos --with-imap-ssl
RUN docker-php-ext-configure \
ldap --with-libdir=lib/x86_64-linux-gnu
RUN docker-php-ext-configure \
opcache --enable-opcache
RUN docker-php-ext-configure \
Expand All @@ -100,7 +112,6 @@ RUN docker-php-ext-install -j$(nproc) \
gmp \
imap \
intl \
ldap \
mysqli \
opcache \
pdo_mysql \
Expand Down Expand Up @@ -133,12 +144,14 @@ RUN pecl install -o -f \
xdebug-3.1.2 \
yaml

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;") \
&& mkdir -p /tmp/blackfire \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
&& echo blackfire.agent_socket=tcp://blackfire:8707 > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
RUN curl -L https://packages.blackfire.io/gpg.key | gpg --dearmor > blackfire.io-archive-keyring.gpg \
&& install -o root -g root -m 644 blackfire.io-archive-keyring.gpg /etc/apt/trusted.gpg.d/ \
&& echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list \
&& apt-get update \
&& apt-get install blackfire-php \
&& rm -rf /var/lib/apt/lists/*
RUN if [ $(uname -m) = "x86_64" ]; then ldap_arch="x86_64-linux-gnu"; else ldap_arch="aarch64-linux-gnu"; fi \
&& docker-php-ext-configure ldap --with-libdir=lib/${ldap_arch}
RUN mkdir -p /tmp/zoo \
&& cd /tmp/zoo \
&& git clone https://github.com/php-zookeeper/php-zookeeper.git \
Expand Down Expand Up @@ -169,13 +182,14 @@ RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
&& rm -rf /tmp/libsodium \
&& pecl install -o -f libsodium
RUN cd /tmp \
&& curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar zxvf ioncube_loaders_lin_x86-64.tar.gz \
&& if [ $(uname -m) = "x86_64" ]; then ioncube_arch="x86-64"; else ioncube_arch="aarch64"; fi \
&& curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_${ioncube_arch}.tar.gz \
&& tar zxvf ioncube_loaders_lin_${ioncube_arch}.tar.gz \
&& export PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") \
&& export PHP_EXT_DIR=$(php-config --extension-dir) \
&& cp "./ioncube/ioncube_loader_lin_${PHP_VERSION}.so" "${PHP_EXT_DIR}/ioncube.so" \
&& rm -rf ./ioncube \
&& rm ioncube_loaders_lin_x86-64.tar.gz
&& rm ioncube_loaders_lin_${ioncube_arch}.tar.gz

ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
Expand Down Expand Up @@ -210,7 +224,7 @@ RUN mkdir -p ${MAGENTO_ROOT}
VOLUME ${MAGENTO_ROOT}

RUN chown -R www:www /usr/local /var/www /var/log /usr/local/etc/php/conf.d /etc/cron.d ${MAGENTO_ROOT} ${COMPOSER_HOME}
RUN if [[ ! -z "${CRONTAB}" ]]; then echo "${CRONTAB}" > /etc/cron.d/magento && touch /var/log/cron.log ; fi
RUN if [ ! -z "${CRONTAB}" ]; then echo "${CRONTAB}" > /etc/cron.d/magento && touch /var/log/cron.log ; fi

ENTRYPOINT ["/docker-entrypoint.sh"]

Expand Down

0 comments on commit 9d84dcf

Please sign in to comment.