Skip to content

Commit

Permalink
Merge pull request #219 from AliMD/feat/wp
Browse files Browse the repository at this point in the history
refactor: php docker files
  • Loading branch information
alimd authored Aug 22, 2022
2 parents b18700d + 5ebf4a5 commit 1f0192e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 14 deletions.
5 changes: 3 additions & 2 deletions packages/classic-cloud/php-apache/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# https://hub.docker.com/_/wordpress/
ARG PHP_VERSION=8.1
ARG IMAGE_NAME=docker.io/php:${PHP_VERSION}-apache

FROM $IMAGE_NAME

FROM docker.io/php:${PHP_VERSION}-apache
WORKDIR /var/www/html
EXPOSE 80

Expand Down
2 changes: 2 additions & 0 deletions packages/classic-cloud/wordpress/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ WORDPRESS_TABLE_PREFIX=wp_
WORDPRESS_DEBUG=

SKIP_FIX_PERMISSIONS=0
APT_INSTALL=libxml2-dev libzip-dev
PHP_EXT_INSTALL=soap pdo_mysql
SOURCEGUARDIAN_LOADER=0
IONCUBE_LOADER=0
2 changes: 2 additions & 0 deletions packages/classic-cloud/wordpress/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ services:
args:
- PHP_VERSION=${PHP_VERSION}
- WORDPRESS_VERSION=${WORDPRESS_VERSION}
- APT_INSTALL=${APT_INSTALL}
- PHP_EXT_INSTALL=${PHP_EXT_INSTALL}
- SOURCEGUARDIAN_LOADER=${SOURCEGUARDIAN_LOADER}
- IONCUBE_LOADER=${IONCUBE_LOADER}

Expand Down
47 changes: 35 additions & 12 deletions packages/classic-cloud/wordpress/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
# https://hub.docker.com/_/wordpress/
ARG PHP_VERSION=8.1
ARG WORDPRESS_VERSION=6.0
ARG IMAGE_NAME=docker.io/wordpress:${WORDPRESS_VERSION}-php${PHP_VERSION}-fpm

FROM docker.io/wordpress:${WORDPRESS_VERSION}-php${PHP_VERSION}-fpm
FROM $IMAGE_NAME

ARG SOURCEGUARDIAN_LOADER=0
ARG IONCUBE_LOADER=0
WORKDIR /var/www/html
EXPOSE 80

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

# Install and enable fu... sourceguardian loader! :_(
ARG APT_INSTALL
RUN set -ex; \
if [ -z "$APT_INSTALL" ]; then \
echo "Skip apt packages: $APT_INSTALL"; \
else \
echo "Installing apt packages"; \
apt-get update -y; \
apt-get install -y --no-install-recommends $APT_INSTALL; \
apt-get autoremove -y; \
apt-get clean -y; \
rm -rfv /var/lib/apt/lists/*; \
fi
ARG PHP_EXT_INSTALL
RUN set -ex; \
if [ -z "$PHP_EXT_INSTALL" ]; then \
echo "Skip php extensions"; \
else \
echo "Installing php extensions: $PHP_EXT_INSTALL"; \
docker-php-ext-install $PHP_EXT_INSTALL; \
fi

ARG SOURCEGUARDIAN_LOADER=0
RUN set -ex; \
if [ "$SOURCEGUARDIAN_LOADER" != "1" ]; then \
echo "Skip install sourceguardian loader"; \
echo "Skip sourceguardian loader"; \
else \
echo "Installing sourceguardian loader"; \
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; \
Expand All @@ -23,11 +49,12 @@ RUN set -ex; \
rm -rf /tmp/sourceguardian; \
fi

# Install and enable fu... ioncube loader! :_(
ARG IONCUBE_LOADER=0
RUN set -ex; \
if [ "$IONCUBE_LOADER" != "1" ]; then \
echo "Skip install ioncube loader"; \
echo "Skip ioncube loader"; \
else \
echo "Installing ioncube loader"; \
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; \
Expand All @@ -38,7 +65,3 @@ RUN set -ex; \
echo "zend_extension=ioncube.so" > $PHP_INI_DIR/conf.d/16-ioncube.ini; \
rm -rf /tmp/ioncube; \
fi

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

0 comments on commit 1f0192e

Please sign in to comment.