Skip to content

Commit

Permalink
Provide ionCube, but disabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed May 21, 2018
1 parent 6507383 commit 42b811f
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 59 deletions.
11 changes: 5 additions & 6 deletions Dockerfiles/mods/Dockerfile-5.3
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LABEL \
### Envs
###
ENV BUILD_DEPS \
wget \
librabbitmq-dev \
libbz2-dev \
libcurl4-openssl-dev \
Expand Down Expand Up @@ -119,11 +118,13 @@ RUN set -x \
\
&& EXTENSION_DIR="$( php -i | grep ^extension_dir | awk -F '=>' '{print $2}' | xargs )" \
&& if [ ! -d "${EXTENSION_DIR}" ]; then mkdir -p "${EXTENSION_DIR}"; fi \
&& wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xvfz ioncube_loaders_lin_x86-64.tar.gz \
&& curl https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -L -o ioncube.tar.gz \
&& tar xvfz ioncube.tar.gz \
&& cd ioncube \
&& cp "ioncube_loader_lin_5.3.so" "${EXTENSION_DIR}/ioncube.so" \
&& echo "zend_extension=${EXTENSION_DIR}/ioncube.so" > /usr/local/etc/php/conf.d/docker-php-ext-ioncube.ini \
&& cd ../ \
&& rm -rf ioncube \
&& rm -rf ioncube.tar.gz \
\
&& echo "/usr" | pecl install amqp \
&& docker-php-ext-enable amqp \
Expand Down Expand Up @@ -258,8 +259,6 @@ RUN set -x \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi

RUN set -x \
&& php -m | grep -oiE '^ionCube Loader$' \
&& php-fpm -m | grep -oiE '^ionCube Loader$' \
&& php -m | grep -oiE '^amqp$' \
&& php-fpm -m | grep -oiE '^amqp$' \
&& php -m | grep -oiE '^apcu$' \
Expand Down
11 changes: 5 additions & 6 deletions Dockerfiles/mods/Dockerfile-5.4
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LABEL \
### Envs
###
ENV BUILD_DEPS \
wget \
librabbitmq-dev \
libbz2-dev \
libcurl4-openssl-dev \
Expand Down Expand Up @@ -119,11 +118,13 @@ RUN set -x \
\
&& EXTENSION_DIR="$( php -i | grep ^extension_dir | awk -F '=>' '{print $2}' | xargs )" \
&& if [ ! -d "${EXTENSION_DIR}" ]; then mkdir -p "${EXTENSION_DIR}"; fi \
&& wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xvfz ioncube_loaders_lin_x86-64.tar.gz \
&& curl https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -L -o ioncube.tar.gz \
&& tar xvfz ioncube.tar.gz \
&& cd ioncube \
&& cp "ioncube_loader_lin_5.4.so" "${EXTENSION_DIR}/ioncube.so" \
&& echo "zend_extension=${EXTENSION_DIR}/ioncube.so" > /usr/local/etc/php/conf.d/docker-php-ext-ioncube.ini \
&& cd ../ \
&& rm -rf ioncube \
&& rm -rf ioncube.tar.gz \
\
&& echo "/usr" | pecl install amqp \
&& docker-php-ext-enable amqp \
Expand Down Expand Up @@ -258,8 +259,6 @@ RUN set -x \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi

RUN set -x \
&& php -m | grep -oiE '^ionCube Loader$' \
&& php-fpm -m | grep -oiE '^ionCube Loader$' \
&& php -m | grep -oiE '^amqp$' \
&& php-fpm -m | grep -oiE '^amqp$' \
&& php -m | grep -oiE '^apcu$' \
Expand Down
11 changes: 5 additions & 6 deletions Dockerfiles/mods/Dockerfile-5.5
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LABEL \
### Envs
###
ENV BUILD_DEPS \
wget \
librabbitmq-dev \
libbz2-dev \
libcurl4-openssl-dev \
Expand Down Expand Up @@ -121,11 +120,13 @@ RUN set -x \
\
&& EXTENSION_DIR="$( php -i | grep ^extension_dir | awk -F '=>' '{print $2}' | xargs )" \
&& if [ ! -d "${EXTENSION_DIR}" ]; then mkdir -p "${EXTENSION_DIR}"; fi \
&& wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xvfz ioncube_loaders_lin_x86-64.tar.gz \
&& curl https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -L -o ioncube.tar.gz \
&& tar xvfz ioncube.tar.gz \
&& cd ioncube \
&& cp "ioncube_loader_lin_5.5.so" "${EXTENSION_DIR}/ioncube.so" \
&& echo "zend_extension=${EXTENSION_DIR}/ioncube.so" > /usr/local/etc/php/conf.d/docker-php-ext-ioncube.ini \
&& cd ../ \
&& rm -rf ioncube \
&& rm -rf ioncube.tar.gz \
\
&& echo "/usr" | pecl install amqp \
&& docker-php-ext-enable amqp \
Expand Down Expand Up @@ -260,8 +261,6 @@ RUN set -x \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi

RUN set -x \
&& php -m | grep -oiE '^ionCube Loader$' \
&& php-fpm -m | grep -oiE '^ionCube Loader$' \
&& php -m | grep -oiE '^amqp$' \
&& php-fpm -m | grep -oiE '^amqp$' \
&& php -m | grep -oiE '^apcu$' \
Expand Down
11 changes: 5 additions & 6 deletions Dockerfiles/mods/Dockerfile-5.6
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LABEL \
### Envs
###
ENV BUILD_DEPS \
wget \
librabbitmq-dev \
libbz2-dev \
libcurl4-openssl-dev \
Expand Down Expand Up @@ -123,11 +122,13 @@ RUN set -x \
\
&& EXTENSION_DIR="$( php -i | grep ^extension_dir | awk -F '=>' '{print $2}' | xargs )" \
&& if [ ! -d "${EXTENSION_DIR}" ]; then mkdir -p "${EXTENSION_DIR}"; fi \
&& wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xvfz ioncube_loaders_lin_x86-64.tar.gz \
&& curl https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -L -o ioncube.tar.gz \
&& tar xvfz ioncube.tar.gz \
&& cd ioncube \
&& cp "ioncube_loader_lin_5.6.so" "${EXTENSION_DIR}/ioncube.so" \
&& echo "zend_extension=${EXTENSION_DIR}/ioncube.so" > /usr/local/etc/php/conf.d/docker-php-ext-ioncube.ini \
&& cd ../ \
&& rm -rf ioncube \
&& rm -rf ioncube.tar.gz \
\
&& echo "/usr" | pecl install amqp \
&& docker-php-ext-enable amqp \
Expand Down Expand Up @@ -262,8 +263,6 @@ RUN set -x \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi

RUN set -x \
&& php -m | grep -oiE '^ionCube Loader$' \
&& php-fpm -m | grep -oiE '^ionCube Loader$' \
&& php -m | grep -oiE '^amqp$' \
&& php-fpm -m | grep -oiE '^amqp$' \
&& php -m | grep -oiE '^apcu$' \
Expand Down
11 changes: 5 additions & 6 deletions Dockerfiles/mods/Dockerfile-7.0
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LABEL \
### Envs
###
ENV BUILD_DEPS \
wget \
librabbitmq-dev \
libbz2-dev \
libcurl4-openssl-dev \
Expand Down Expand Up @@ -121,11 +120,13 @@ RUN set -x \
\
&& EXTENSION_DIR="$( php -i | grep ^extension_dir | awk -F '=>' '{print $2}' | xargs )" \
&& if [ ! -d "${EXTENSION_DIR}" ]; then mkdir -p "${EXTENSION_DIR}"; fi \
&& wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xvfz ioncube_loaders_lin_x86-64.tar.gz \
&& curl https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -L -o ioncube.tar.gz \
&& tar xvfz ioncube.tar.gz \
&& cd ioncube \
&& cp "ioncube_loader_lin_7.0.so" "${EXTENSION_DIR}/ioncube.so" \
&& echo "zend_extension=${EXTENSION_DIR}/ioncube.so" > /usr/local/etc/php/conf.d/docker-php-ext-ioncube.ini \
&& cd ../ \
&& rm -rf ioncube \
&& rm -rf ioncube.tar.gz \
\
&& echo "/usr" | pecl install amqp \
&& docker-php-ext-enable amqp \
Expand Down Expand Up @@ -265,8 +266,6 @@ RUN set -x \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi

RUN set -x \
&& php -m | grep -oiE '^ionCube Loader$' \
&& php-fpm -m | grep -oiE '^ionCube Loader$' \
&& php -m | grep -oiE '^amqp$' \
&& php-fpm -m | grep -oiE '^amqp$' \
&& php -m | grep -oiE '^apcu$' \
Expand Down
11 changes: 5 additions & 6 deletions Dockerfiles/mods/Dockerfile-7.1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LABEL \
### Envs
###
ENV BUILD_DEPS \
wget \
librabbitmq-dev \
libbz2-dev \
libcurl4-openssl-dev \
Expand Down Expand Up @@ -121,11 +120,13 @@ RUN set -x \
\
&& EXTENSION_DIR="$( php -i | grep ^extension_dir | awk -F '=>' '{print $2}' | xargs )" \
&& if [ ! -d "${EXTENSION_DIR}" ]; then mkdir -p "${EXTENSION_DIR}"; fi \
&& wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xvfz ioncube_loaders_lin_x86-64.tar.gz \
&& curl https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -L -o ioncube.tar.gz \
&& tar xvfz ioncube.tar.gz \
&& cd ioncube \
&& cp "ioncube_loader_lin_7.1.so" "${EXTENSION_DIR}/ioncube.so" \
&& echo "zend_extension=${EXTENSION_DIR}/ioncube.so" > /usr/local/etc/php/conf.d/docker-php-ext-ioncube.ini \
&& cd ../ \
&& rm -rf ioncube \
&& rm -rf ioncube.tar.gz \
\
&& echo "/usr" | pecl install amqp \
&& docker-php-ext-enable amqp \
Expand Down Expand Up @@ -267,8 +268,6 @@ RUN set -x \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi

RUN set -x \
&& php -m | grep -oiE '^ionCube Loader$' \
&& php-fpm -m | grep -oiE '^ionCube Loader$' \
&& php -m | grep -oiE '^amqp$' \
&& php-fpm -m | grep -oiE '^amqp$' \
&& php -m | grep -oiE '^apcu$' \
Expand Down
11 changes: 5 additions & 6 deletions Dockerfiles/mods/Dockerfile-7.2
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LABEL \
### Envs
###
ENV BUILD_DEPS \
wget \
librabbitmq-dev \
libbz2-dev \
libcurl4-openssl-dev \
Expand Down Expand Up @@ -122,11 +121,13 @@ RUN set -x \
\
&& EXTENSION_DIR="$( php -i | grep ^extension_dir | awk -F '=>' '{print $2}' | xargs )" \
&& if [ ! -d "${EXTENSION_DIR}" ]; then mkdir -p "${EXTENSION_DIR}"; fi \
&& wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xvfz ioncube_loaders_lin_x86-64.tar.gz \
&& curl https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -L -o ioncube.tar.gz \
&& tar xvfz ioncube.tar.gz \
&& cd ioncube \
&& cp "ioncube_loader_lin_7.2.so" "${EXTENSION_DIR}/ioncube.so" \
&& echo "zend_extension=${EXTENSION_DIR}/ioncube.so" > /usr/local/etc/php/conf.d/docker-php-ext-ioncube.ini \
&& cd ../ \
&& rm -rf ioncube \
&& rm -rf ioncube.tar.gz \
\
&& pecl install amqp \
&& docker-php-ext-enable amqp \
Expand Down Expand Up @@ -270,8 +271,6 @@ RUN set -x \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi

RUN set -x \
&& php -m | grep -oiE '^ionCube Loader$' \
&& php-fpm -m | grep -oiE '^ionCube Loader$' \
&& php -m | grep -oiE '^amqp$' \
&& php-fpm -m | grep -oiE '^amqp$' \
&& php -m | grep -oiE '^apcu$' \
Expand Down
51 changes: 51 additions & 0 deletions Dockerfiles/prod/data/docker-entrypoint.d/38-enable-modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

set -e
set -u
set -o pipefail


############################################################
# Functions
############################################################

###
### Enable PHP Modules
###
enable_modules() {
local mod_varname="${1}"
local debug="${2}"
local cfg_path="/usr/local/etc/php/conf.d"
local mod_path=
mod_path="$( php -i | grep ^extension_dir | awk -F '=>' '{print $2}' | xargs )"


if ! env_set "${mod_varname}"; then
log "info" "\$${mod_varname} not set. Not enabling any PHP modules." "${debug}"
else
mods="$( env_get "${mod_varname}" )"

if [ -z "${mods}" ]; then
log "info" "\$${mod_varname} set, but empty. Not enabling any PHP modules." "${debug}"
else
log "info" "Enabling the following PHP modules: ${mods}" "${debug}"
fi

while read -r mod; do
mod="$( echo "${mod}" | xargs )" # trim

# Does the module exist?
if [ -f "${mod_path}/${mod}.so" ]; then
# Exceptions to load speficially
if [ "${mod}" = "ioncube" ]; then
run "eche 'zend_extension=${mod_path}/ioncube.so' > '${cfg_path}/docker-ext-php-ext-ioncube.ini'" "${debug}"
# Generic Load
else
run "docker-php-ext-enable ${mod} || true" "${debug}"
fi
else
log "warn" "Enabling PHP Module: '${mod}' does not exist" "${debug}"
fi
done <<< "$( echo "${mods}" | tr ',' '\n' )"
fi
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,24 @@ set -o pipefail
disable_modules() {
local mod_varname="${1}"
local debug="${2}"
local mod_path="/usr/local/etc/php/conf.d"
local cfg_path="/usr/local/etc/php/conf.d"

if ! env_set "${mod_varname}"; then
log "info" "\$${mod_varname} not set. Not disabling any PHP modules." "${debug}"
else
mods="$( env_get "${mod_varname}" )"

if [ -z "${mods}" ]; then
log "warn" "\$${mod_varname} set, but empty. Not disabling any PHP modules." "${debug}"
log "info" "\$${mod_varname} set, but empty. Not disabling any PHP modules." "${debug}"
else
log "info" "Disabling the following PHP modules: ${mods}" "${debug}"
fi

while read -r mod; do
#for mod in ${mods//,/ }; do
mod="$( echo "${mod}" | xargs )" # trim

# Find all config files that enable that module
files="$( grep -Er "^(zend_)?extension.*(=|/)${mod}\.so" "${mod_path}" || true )"
files="$( grep -Er "^(zend_)?extension.*(=|/)${mod}\.so" "${cfg_path}" || true )"

if [ -n "${files}" ]; then
while read -r f; do
Expand All @@ -44,6 +43,5 @@ disable_modules() {
done <<< "${files}"
fi
done <<< "$( echo "${mods}" | tr ',' '\n' )"
#done
fi
}
6 changes: 6 additions & 0 deletions Dockerfiles/prod/data/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ copy_ini_files "${PHP_CUST_INI_DIR}" "${PHP_INI_DIR}" "${DEBUG_LEVEL}"
copy_fpm_files "${PHP_CUST_FPM_DIR}" "${PHP_FPM_DIR}" "${DEBUG_LEVEL}"


###
### Enable PHP Modules
###
enable_modules "ENABLE_MODULES" "${DEBUG_LEVEL}"


###
### Disable PHP Modules
###
Expand Down
6 changes: 6 additions & 0 deletions Dockerfiles/work/data/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ copy_ini_files "${PHP_CUST_INI_DIR}" "${PHP_INI_DIR}" "${DEBUG_LEVEL}"
copy_fpm_files "${PHP_CUST_FPM_DIR}" "${PHP_FPM_DIR}" "${DEBUG_LEVEL}"


###
### Enable PHP Modules
###
enable_modules "ENABLE_MODULES" "${DEBUG_LEVEL}"


###
### Disable PHP Modules
###
Expand Down
Loading

0 comments on commit 42b811f

Please sign in to comment.