Skip to content

Commit 14f7697

Browse files
committed
dockerfile adds, PHPRedis added to build
1 parent a4e8c58 commit 14f7697

File tree

6 files changed

+21
-12
lines changed

6 files changed

+21
-12
lines changed

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN BUILD_DEPS='software-properties-common' \
1515
&& add-apt-repository -y ppa:ondrej/php \
1616
&& add-apt-repository -y ppa:deadsnakes/ppa
1717

18-
RUN apt update && apt install -y python3.7 python3-pip curl apache2 libsasl2-modules libapache2-mod-php7.4 libmcrypt-dev php7.4-cli php7.4-dev php7.4-readline php7.4-mbstring php7.4-zip php7.4-intl php7.4-xml php7.4-bcmath php7.4-xmlrpc php7.4-json php7.4-curl php7.4-gd php7.4-pgsql php7.4-mysql php-pear \
18+
RUN apt update && apt install -y python3.7 curl apache2 libsasl2-modules libapache2-mod-php7.4 libmcrypt-dev php7.4-cli php7.4-dev php7.4-readline php7.4-mbstring php7.4-zip php7.4-intl php7.4-xml php7.4-bcmath php7.4-xmlrpc php7.4-json php7.4-curl php7.4-gd php7.4-pgsql php7.4-mysql php-pear \
1919
&& apt update && apt install -yq --no-install-recommends \
2020
git \
2121
cron \
@@ -37,9 +37,8 @@ RUN apt update && apt install -y python3.7 python3-pip curl apache2 libsasl2-mod
3737
&& apt autoremove -y \
3838
&& rm -rf /var/lib/apt/lists/* \
3939
&& pecl channel-update pecl.php.net \
40-
&& pecl install mcrypt-1.0.3 -y
41-
42-
RUN python3 -m pip install certbot-dns-cloudflare
40+
&& pecl install mcrypt-1.0.3 \
41+
&& pecl install redis -y
4342

4443
# POSTFIX
4544
RUN update-locale LANG=en_US.UTF-8
@@ -59,7 +58,7 @@ RUN chmod -R 755 /opt/* \
5958
&& cp /opt/app/supervisord /etc/supervisor/conf.d/supervisord.conf
6059

6160
# COMPOSER
62-
RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
61+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
6362
RUN composer global require "laravel/installer"
6463
RUN composer global require "vlucas/phpdotenv"
6564

app/php_extensions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
header('Content-Type: text/plain; charset=utf-8');
77

88
// The following modules, should exist in the build
9-
$modules = 'apache2handler,calendar,ctype,curl,date,dom,exif,fileinfo,filter,ftp,gd,gettext,hash,iconv,imagick,json,libxml,mbstring,mcrypt,mysqli,mysqlnd,openssl,pcre,pdo,pdo_mysql,phar,posix,readline,reflection,session,shmop,simplexml,sockets,spl,standard,sysvmsg,sysvsem,sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,opcache.enable,zip,zlib, mod_deflate, mod_filter';
9+
$modules = 'apache2handler,calendar,ctype,curl,date,dom,exif,fileinfo,filter,ftp,gd,gettext,hash,iconv,imagick,json,libxml,mbstring,mcrypt,mysqli,mysqlnd,openssl,pcre,pdo,pdo_mysql,phar,posix,readline,reflection,redis,session,shmop,simplexml,sockets,spl,standard,sysvmsg,sysvsem,sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,opcache.enable,zip,zlib,mod_deflate,mod_filter';
1010

1111
$mods_check = array_map('trim', explode(",",$modules));
1212

app/run.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,19 @@ fi
7575
#####
7676
if [ ! -f /etc/php/7.4/apache2/build ]; then
7777

78-
# Tweak Apache build
78+
# Tweak Apache Build
7979
sed -i 's|;include_path = ".:/usr/share/php"|include_path = ".:/usr/share/php:/data/pear"|g' /etc/php/7.4/apache2/php.ini
8080
sed -i 's/variables_order.*/variables_order = \"EGPCS\"/g' /etc/php/7.4/apache2/php.ini
8181
sed -i 's/IncludeOptional sites-enabled\/\*.conf/IncludeOptional \/data\/apache2\/sites-enabled\/*.conf/' /etc/apache2/apache2.conf
8282
sed -i 's|;error_log = php_errors.log|error_log = /data/apache2/logs/error_log|g' /etc/php/7.4/apache2/php.ini
8383
echo "extension=mcrypt.so" > /etc/php/7.4/apache2/conf.d/mcrypt.ini
8484

85-
# Update the PHP.ini file, enable <? ?> tags and quiet logging.
85+
# Setup Redis
86+
echo "extension=redis.so" > /etc/php/7.4/mods-available/redis.ini
87+
ln -sf /etc/php/7.4/mods-available/redis.ini /etc/php/7.4/cli/conf.d/20-redis.ini
88+
ln -sf /etc/php/7.4/mods-available/redis.ini /etc/php/7.4/apache2/conf.d/20-redis.ini
89+
90+
# Update the PHP.ini file, enable <? ?> tags
8691
sed -i 's|short_open_tag = Off|short_open_tag = On|g' /etc/php/7.4/apache2/php.ini
8792

8893
# Sessions & garbage collection
@@ -112,15 +117,17 @@ if [ ! -f /etc/php/7.4/apache2/build ]; then
112117
if [ "$NODE_ENVIRONMENT" == 'dev' ]; then
113118
# Tweak Apache build
114119
sed -i 's|\[PHP\]|\[PHP\] \nIS_LIVE=0 \nIS_DEV=1 \nNODE_ENVIRONMENT=dev \n;The IS_DEV is set for testing outside of DEV environments ie: test.domain.tld|g' /etc/php/7.4/apache2/php.ini
115-
# Update the PHP.ini file, enable <? ?> tags and quiet logging.
116-
sed -i "s/error_reporting = .*$/error_reporting = E_ALL/" /etc/php/7.4/apache2/php.ini
120+
# Log errors into log files
121+
sed -i 's/error_reporting = .*$/error_reporting = E_ALL/' /etc/php/7.4/apache2/php.ini
122+
# Default is 1024 and 0 allows to not apply any maximum length at all
123+
sed -i 's|log_errors_max_len = 1024|log_errors_max_len = 0|g' /etc/php/7.4/apache2/php.ini
117124
fi
118125

119126
if [ "$NODE_ENVIRONMENT" == 'production' ]; then
120127
# Tweak Apache build
121128
sed -i 's|\[PHP\]|\[PHP\] \nIS_LIVE=1 \nIS_DEV=0 \nNODE_ENVIRONMENT=production \n;The IS_DEV is set for testing outside of DEV environments ie: test.domain.tld|g' /etc/php/7.4/apache2/php.ini
122-
# Update the PHP.ini file, enable <? ?> tags and quiet logging.
123-
sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php/7.4/apache2/php.ini
129+
# Log errors into log files
130+
sed -i 's/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/' /etc/php/7.4/apache2/php.ini
124131
fi
125132

126133
fi

docker-compose.local.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: '3.3'
22
services:
33
web:
44
image: 'htmlgraphic/apache:latest'
5+
restart: unless-stopped
56
container_name: apache
67
volumes:
78
- '~/SITES/docker:/data' # <- Change to preferred local working dir

tests/cli_php_modules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pdo
2424
pdo_mysql
2525
phar
2626
posix
27+
redis
2728
readline
2829
session
2930
shmop

tests/php_modules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pdo
2626
pdo_mysql
2727
phar
2828
posix
29+
redis
2930
readline
3031
reflection
3132
session

0 commit comments

Comments
 (0)