Skip to content

Commit

Permalink
feat(wordpress): args for install ioncube loader
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed Aug 15, 2022
1 parent 9c4b036 commit 6e5fe71
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
7 changes: 6 additions & 1 deletion packages/lab/wordpress/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ DOMAIN=wp.mihandoost.com
NGINX_VERSION=1.21
PHP_VERSION=8.1
WORDPRESS_VERSION=6.0

NGINX_MEMOTY_LIMIT=256m
PHP_MEMOTY_LIMIT=2048m

WORDPRESS_DB_HOST=mariadb_database_1.alwatr-private-network
WORDPRESS_DB_USER=alwatr
WORDPRESS_DB_PASSWORD=secret-password
WORDPRESS_DB_NAME=database
WORDPRESS_TABLE_PREFIX=wp_
WORDPRESS_DEBUG=
SKIP_FIX_PERMISSIONS=

SKIP_FIX_PERMISSIONS=0
SOURCEGUARDIAN_LOADER=0
IONCUBE_LOADER=0
2 changes: 1 addition & 1 deletion packages/lab/wordpress/_up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ time docker-compose up --detach --remove-orphans --force-recreate

echoStep "Fix permitions..."

time docker-compose exec php "fix-permition.sh"
time docker-compose exec php "fix-permition.sh" || true

echoStep "Done"

Expand Down
2 changes: 2 additions & 0 deletions packages/lab/wordpress/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ services:
args:
- PHP_VERSION=${PHP_VERSION}
- WORDPRESS_VERSION=${WORDPRESS_VERSION}
- SOURCEGUARDIAN_LOADER=${SOURCEGUARDIAN_LOADER}
- IONCUBE_LOADER=${IONCUBE_LOADER}

hostname: php.alwatr.io

Expand Down
27 changes: 23 additions & 4 deletions packages/lab/wordpress/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,35 @@ ARG WORDPRESS_VERSION=6.0

FROM wordpress:${WORDPRESS_VERSION}-php${PHP_VERSION}-fpm

# Install and enable Source Gaurdian loader! :_(
RUN PHP_VERSION=$(php -v | head -n1 | cut -d' ' -f2 | cut -d. -f1-2) \
ARG SOURCEGUARDIAN_LOADER=0
ARG IONCUBE_LOADER=0

# Install and enable fu... sourceguardian loader! :_(
RUN echo "SOURCEGUARDIAN_LOADER: $SOURCEGUARDIAN_LOADER" \
&& [ "$SOURCEGUARDIAN_LOADER" = "1" ] \
&& PHP_VERSION=$(php -v | head -n1 | cut -d' ' -f2 | cut -d. -f1-2) \
&& PHP_EXT_DIR=$(php -i | grep '^extension_dir =' | cut -d' ' -f3) \
&& mkdir -p /tmp/sourceguardian \
&& cd /tmp/sourceguardian \
&& curl -Os https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz \
&& curl -sSLO https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz \
&& tar xzf loaders.linux-x86_64.tar.gz \
&& cp ixed.${PHP_VERSION}.lin "$(php -i | grep '^extension_dir =' | cut -d' ' -f3)/sourceguardian.so" \
&& mv ixed.${PHP_VERSION}.lin "$PHP_EXT_DIR/sourceguardian.so" \
&& echo "extension=sourceguardian.so" > /usr/local/etc/php/conf.d/15-sourceguardian.ini \
&& rm -rf /tmp/sourceguardian

# Install and enable fu... ioncube loader! :_(
RUN echo "IONCUBE_LOADER: $IONCUBE_LOADER" \
&& [ "$IONCUBE_LOADER" = "1" ] \
&& PHP_VERSION=$(php -v | head -n1 | cut -d' ' -f2 | cut -d. -f1-2) \
&& PHP_EXT_DIR=$(php -i | grep '^extension_dir =' | cut -d' ' -f3) \
&& mkdir -p /tmp/ioncube \
&& cd /tmp/ioncube \
&& curl -sSLO http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xzf ioncube_loaders_lin_x86-64.tar.gz \
&& mv ioncube/ioncube_loader_lin_${PHP_VERSION}.so "$PHP_EXT_DIR/ioncube.so" \
&& echo "zend_extension=ioncube.so" > /usr/local/etc/php/conf.d/16-ioncube.ini \
&& rm -rf /tmp/ioncube

COPY php.conf.ini $PHP_INI_DIR/conf.d/
COPY fix-permition.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/fix-permition.sh
2 changes: 1 addition & 1 deletion packages/lab/wordpress/php/fix-permition.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -Eeuo pipefail
trap "echo '❌ Error'" ERR

if [ ! -z "${SKIP_FIX_PERMISSIONS:-}" ]
if [ "${SKIP_FIX_PERMISSIONS:-}" = "1" ]
then
echo "Skip fix permitions"
exit 0
Expand Down

0 comments on commit 6e5fe71

Please sign in to comment.