Skip to content

Commit 77fe237

Browse files
author
Fillip Hannisdal
authored
Add php-apache-54 after passing build
1 parent 1707de5 commit 77fe237

File tree

5 files changed

+137
-0
lines changed

5 files changed

+137
-0
lines changed

php-apache-54/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM php:5.4-apache
2+
3+
ARG DOCKER_PHP_EXT_INSTALL
4+
ARG DOCKER_PHP_PECL_INSTALL
5+
6+
# https://hub.docker.com/_/composer/
7+
COPY --from=composer:1.6.5 /usr/bin/composer /usr/bin/composer
8+
ENV COMPOSER_ALLOW_SUPERUSER 1
9+
ENV COMPOSER_HOME /tmp
10+
ENV COMPOSER_VERSION 1.6.5
11+
12+
# https://github.com/wimg/PHPCompatibility/releases
13+
ENV PHP_COMPATIBILITY_VERSION 8.1.0
14+
15+
ENV APACHE_LOG_DIR logs
16+
17+
COPY override.ini /usr/local/etc/php/conf.d/
18+
19+
COPY . /tmp/.
20+
RUN /tmp/build.sh

php-apache-54/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.4.45

php-apache-54/build.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
DOCKER_PHP_EXT_INSTALL="bcmath bz2 calendar dba exif gettext iconv imap intl mcrypt mysqli pdo_dblib pcntl pspell soap sockets xmlrpc xsl zip"
6+
DOCKER_PHP_PECL_INSTALL="apc igbinary memcache redis"
7+
8+
RUN_PACKAGES=""
9+
TMP_PACKAGES=""
10+
RUN_PACKAGES="$RUN_PACKAGES freetds-bin"
11+
RUN_PACKAGES="$RUN_PACKAGES freetds-common"
12+
RUN_PACKAGES="$RUN_PACKAGES freetds-dev"
13+
RUN_PACKAGES="$RUN_PACKAGES libc-client2007e"
14+
TMP_PACKAGES="$TMP_PACKAGES libgmp-dev"
15+
TMP_PACKAGES="$TMP_PACKAGES libc-client2007e-dev"
16+
RUN_PACKAGES="$RUN_PACKAGES libkrb5-dev"
17+
TMP_PACKAGES="$TMP_PACKAGES libldap2-dev"
18+
RUN_PACKAGES="$RUN_PACKAGES libmcrypt-dev"
19+
RUN_PACKAGES="$RUN_PACKAGES libpspell-dev"
20+
RUN_PACKAGES="$RUN_PACKAGES libxslt1-dev"
21+
TMP_PACKAGES="$TMP_PACKAGES libfreetype6-dev" # gd
22+
RUN_PACKAGES="$RUN_PACKAGES libgd3" # gd
23+
TMP_PACKAGES="$TMP_PACKAGES libgd-dev" # gd
24+
TMP_PACKAGES="$TMP_PACKAGES libjpeg62-turbo-dev" # gd
25+
RUN_PACKAGES="$RUN_PACKAGES libmagickwand-6.q16" # imagick
26+
TMP_PACKAGES="$TMP_PACKAGES libmagickwand-6.q16-dev" # imagick
27+
TMP_PACKAGES="$TMP_PACKAGES libmemcached-dev" # memcached
28+
RUN_PACKAGES="$RUN_PACKAGES libmemcachedutil2" # memcached
29+
TMP_PACKAGES="$TMP_PACKAGES libpng-dev" # gd
30+
RUN_PACKAGES="$RUN_PACKAGES libssl-dev"
31+
RUN_PACKAGES="$RUN_PACKAGES libbz2-dev" # bz2
32+
RUN_PACKAGES="$RUN_PACKAGES libxml2-dev" # soap
33+
RUN_PACKAGES="$RUN_PACKAGES libicu-dev" # icu
34+
RUN_PACKAGES="$RUN_PACKAGES libxpm4" # gd
35+
TMP_PACKAGES="$TMP_PACKAGES libxpm-dev" # gd
36+
TMP_PACKAGES="$TMP_PACKAGES libwebp-dev" # gd
37+
RUN_PACKAGES="$RUN_PACKAGES mysql-client"
38+
TMP_PACKAGES="$TMP_PACKAGES git"
39+
RUN_PACKAGES="$RUN_PACKAGES unzip"
40+
eval "apt update && apt upgrade -y && apt-get update && apt-get install --no-install-recommends -y $TMP_PACKAGES $RUN_PACKAGES"
41+
42+
eval "ln -s /usr/lib/x86_64-linux-gnu/libsybdb.a /usr/lib/"
43+
44+
case "$DOCKER_PHP_EXT_INSTALL" in
45+
*gd*)
46+
echo 'Preparing module: gd...'
47+
docker-php-ext-configure gd \
48+
--with-gd=/usr/include \
49+
--enable-gd-native-ttf \
50+
--with-freetype-dir=/usr/include/ \
51+
--with-jpeg-dir=/usr/include/ \
52+
--with-png-dir=/usr/include/ \
53+
--with-webp-dir=/usr/include/ \
54+
--with-xpm-dir=/usr/include
55+
;;
56+
esac
57+
58+
case "$DOCKER_PHP_EXT_INSTALL" in
59+
*imap*)
60+
echo 'Preparing module: imap...'
61+
docker-php-ext-configure imap \
62+
--with-kerberos \
63+
--with-imap-ssl
64+
;;
65+
esac
66+
67+
# for improved ASLR and optimizations
68+
# https://github.com/docker-library/php/issues/105#issuecomment-278114879
69+
export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS"
70+
71+
eval "docker-php-ext-install $DOCKER_PHP_EXT_INSTALL"
72+
eval "pecl install imagick $DOCKER_PHP_PECL_INSTALL"
73+
eval "docker-php-ext-enable imagick $DOCKER_PHP_PECL_INSTALL"
74+
/tmp/build_apache.sh
75+
76+
# clean up
77+
pecl clear-cache
78+
rm -rf /tmp/* /var/lib/apt/lists/*
79+
eval apt-mark manual "$RUN_PACKAGES"
80+
eval "apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $TMP_PACKAGES"
81+
82+
# Enable mod_rewrite for apache images
83+
a2enmod rewrite
84+
service apache2 restart

php-apache-54/build_apache.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
eval "mkdir /etc/apache2/logs/"
6+
7+
# phpcs
8+
pear install PHP_CodeSniffer
9+
curl -Lo /tmp/PHPCompatibility.tar.gz "https://github.com/wimg/PHPCompatibility/archive/${PHP_COMPATIBILITY_VERSION}.tar.gz"
10+
tar -xzf /tmp/PHPCompatibility.tar.gz -C /usr/local/share/
11+
phpcs --config-set installed_paths "/usr/local/share/PHPCompatibility-${PHP_COMPATIBILITY_VERSION}"
12+
13+
# tls
14+
openssl req \
15+
-days 365 \
16+
-keyout /etc/ssl/private/ssl-cert-snakeoil.key \
17+
-newkey rsa:4096 \
18+
-nodes \
19+
-out /etc/ssl/certs/ssl-cert-snakeoil.pem \
20+
-subj "/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/CN=php-apache.docker" \
21+
-x509
22+
a2enmod ssl
23+
a2ensite default-ssl

php-apache-54/override.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
display_startup_errors = On
2+
enable_dl = Off
3+
error_reporting = E_ALL
4+
log_errors = On
5+
mail.add_x_header = On
6+
max_input_vars = 100000
7+
request_order = GP
8+
short_open_tag = Off
9+
track_errors = On

0 commit comments

Comments
 (0)