Skip to content

Commit fda86ae

Browse files
author
Laszlo Malina
committed
Added 7.3 php version
1 parent 2547c7e commit fda86ae

12 files changed

Lines changed: 990 additions & 8 deletions

File tree

‎7.3/README.md‎

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# PHP 7.3 information
2+
3+
## Installation
4+
```bash
5+
docker pull ghcr.io/optimode/php:7.3-cli
6+
docker pull ghcr.io/optimode/php:7.3-fpm
7+
docker pull ghcr.io/optimode/php:7.3-apache
8+
```
9+
10+
## Docker compose
11+
```yaml
12+
services:
13+
php73:
14+
image: ghcr.io/optimode/php:7.3-fpm
15+
container_name: php73
16+
hostname: php73
17+
restart: no
18+
#user: 1000:1000
19+
stdin_open: true
20+
tty: true
21+
```
22+
23+
## Docker run
24+
```bash
25+
docker run -d --rm --name php73 ghcr.io/optimode/php:7.3-fpm
26+
```
27+
28+
## Available tags
29+
- 7.3-cli
30+
- 7.3-fpm
31+
- 7.3-apache
32+
33+
## Installed extensions
34+
The following modules and extensions have been enabled:
35+
36+
```
37+
[PHP Modules]
38+
amqp
39+
apcu
40+
bcmath
41+
bz2
42+
calendar
43+
Core
44+
csv
45+
ctype
46+
curl
47+
date
48+
dba
49+
dom
50+
enchant
51+
exif
52+
fileinfo
53+
filter
54+
ftp
55+
gd
56+
gettext
57+
gmp
58+
gnupg
59+
grpc
60+
hash
61+
http
62+
iconv
63+
igbinary
64+
imagick
65+
imap
66+
intl
67+
json
68+
libxml
69+
lz4
70+
lzf
71+
mbstring
72+
memcache
73+
memcached
74+
mongodb
75+
msgpack
76+
mysqli
77+
mysqlnd
78+
OAuth
79+
openssl
80+
pcntl
81+
pcre
82+
PDO
83+
pdo_dblib
84+
pdo_mysql
85+
pdo_pgsql
86+
pdo_sqlite
87+
pgsql
88+
Phar
89+
posix
90+
protobuf
91+
pspell
92+
psr
93+
random
94+
raphf
95+
readline
96+
redis
97+
Reflection
98+
session
99+
shmop
100+
SimpleXML
101+
snmp
102+
soap
103+
sockets
104+
sodium
105+
SPL
106+
sqlite3
107+
standard
108+
sysvmsg
109+
sysvsem
110+
sysvshm
111+
tidy
112+
timezonedb
113+
tokenizer
114+
uploadprogress
115+
uuid
116+
xdebug
117+
xhprof
118+
xlswriter
119+
xml
120+
xmlreader
121+
xmlrpc
122+
xmlwriter
123+
xsl
124+
yaml
125+
Zend OPcache
126+
zip
127+
zlib
128+
zstd
129+
130+
[Zend Modules]
131+
Xdebug
132+
Zend OPcache
133+
```

‎7.3/apache/Dockerfile‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
FROM optimode/php:7.3-cli
2+
3+
ENV APACHE_CONFDIR /etc/apache2
4+
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
5+
6+
RUN set -eux; \
7+
apt-get update; \
8+
apt-get install -y --no-install-recommends apache2; \
9+
rm -rf /var/lib/apt/lists/*; \
10+
sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
11+
\
12+
# setup directories and permissions
13+
. "$APACHE_ENVVARS"; \
14+
for dir in \
15+
"$APACHE_LOCK_DIR" \
16+
"$APACHE_RUN_DIR" \
17+
"$APACHE_LOG_DIR" \
18+
# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205
19+
"$APACHE_RUN_DIR/socks" \
20+
; do \
21+
rm -rvf "$dir"; \
22+
mkdir -p "$dir"; \
23+
chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
24+
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
25+
chmod 1777 "$dir"; \
26+
done; \
27+
\
28+
# delete the "index.html" that installing Apache drops in here
29+
rm -rvf /var/www/html/*; \
30+
# delete apache config folder
31+
rm -rvf /etc/apache2/*; \
32+
\
33+
# logs should go to stdout / stderr
34+
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
35+
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
36+
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
37+
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
38+
39+
COPY ./data/apache2-foreground /usr/local/bin/
40+
COPY --from=php:7.3-apache /usr/lib/apache2/modules/libphp7.so /usr/lib/apache2/modules/libphp.so
41+
COPY --from=php:7.3-apache /etc/apache2 /etc/apache2
42+
43+
# Apache + PHP requires preforking Apache for best results
44+
RUN a2dismod mpm_event && a2enmod mpm_prefork
45+
46+
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
47+
LABEL "org.opencontainers.image.title"="PHP 7.3 APACHE"
48+
LABEL "org.opencontainers.image.description"="PHP 7.3 APACHE with many extensions"
49+
LABEL "org.opencontainers.image.url"="$URL"
50+
LABEL "org.opencontainers.image.source"="$SOURCE"
51+
LABEL "org.opencontainers.image.version"="7.3"
52+
LABEL "org.opencontainers.image.revision"="$REVISION"
53+
LABEL "org.opencontainers.image.licenses"="MIT"
54+
LABEL "org.opencontainers.image.created"="$BUILD_DATE"
55+
LABEL "org.opencontainers.image.authors"="$AUTHORS"
56+
LABEL "org.opencontainers.image.vendor"="$VENDOR"
57+
LABEL "org.opencontainers.image.base.name"="optimode/php:7.3-cli"
58+
LABEL "org.opencontainers.image.ref.name"="7.3-apache"
59+
60+
WORKDIR /var/www/html
61+
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
62+
STOPSIGNAL SIGWINCH
63+
EXPOSE 80
64+
65+
CMD ["apache2-foreground"]
66+
ENTRYPOINT ["/docker-entrypoint.sh"]

‎7.3/apache/data/apache2-foreground‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background.
5+
# (also, when run as "apache2ctl <apache args>", it does not use "exec", which leaves an undesirable resident shell process)
6+
7+
: "${APACHE_CONFDIR:=/etc/apache2}"
8+
: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}"
9+
if test -f "$APACHE_ENVVARS"; then
10+
. "$APACHE_ENVVARS"
11+
fi
12+
13+
# Apache gets grumpy about PID files pre-existing
14+
: "${APACHE_RUN_DIR:=/var/run/apache2}"
15+
: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}"
16+
rm -f "$APACHE_PID_FILE"
17+
18+
# create missing directories
19+
# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR)
20+
for e in "${!APACHE_@}"; do
21+
if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then
22+
# handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir
23+
# mkdir: cannot create directory '/var/lock': File exists
24+
dir="${!e}"
25+
while [ "$dir" != "$(dirname "$dir")" ]; do
26+
dir="$(dirname "$dir")"
27+
if [ -d "$dir" ]; then
28+
break
29+
fi
30+
absDir="$(readlink -f "$dir" 2>/dev/null || :)"
31+
if [ -n "$absDir" ]; then
32+
mkdir -p "$absDir"
33+
fi
34+
done
35+
36+
mkdir -p "${!e}"
37+
fi
38+
done
39+
40+
exec apache2 -DFOREGROUND "$@"

‎7.3/cli/Dockerfile‎

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
FROM php:7.3-cli
2+
3+
### Envs
4+
ENV MY_USER="optimode" \
5+
MY_GROUP="optimode" \
6+
MY_UID="1000" \
7+
MY_GID="1000" \
8+
PHP_VERSION="7.3"
9+
10+
# Install dependencies
11+
RUN set -eux \
12+
&& DEBIAN_FRONTEND=noninteractive apt-get update \
13+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
14+
procps \
15+
curl \
16+
openssh-server \
17+
supervisor \
18+
nano \
19+
git
20+
21+
# Install PHP extensions installer
22+
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
23+
24+
# Install PHP extensions
25+
RUN install-php-extensions \
26+
amqp \
27+
apcu \
28+
bcmath \
29+
bz2 \
30+
calendar \
31+
csv \
32+
dba \
33+
enchant \
34+
exif \
35+
ftp \
36+
gd \
37+
gettext \
38+
gmp \
39+
gnupg \
40+
grpc \
41+
http \
42+
igbinary \
43+
imagick \
44+
imap \
45+
intl \
46+
lz4 \
47+
lzf \
48+
memcache \
49+
memcached \
50+
mongodb \
51+
msgpack \
52+
mysqli \
53+
oauth \
54+
opcache \
55+
pcntl \
56+
pdo_dblib \
57+
pdo_mysql \
58+
pdo_pgsql \
59+
pgsql \
60+
protobuf \
61+
pspell \
62+
psr \
63+
redis \
64+
shmop \
65+
snmp \
66+
soap \
67+
sockets \
68+
sodium \
69+
sysvmsg \
70+
sysvsem \
71+
sysvshm \
72+
tidy \
73+
timezonedb \
74+
uploadprogress \
75+
uuid \
76+
xdebug \
77+
xhprof \
78+
xlswriter \
79+
xmlrpc \
80+
xsl \
81+
yaml \
82+
zip \
83+
zstd
84+
85+
RUN set -eux \
86+
# empty apt lists
87+
&& sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config \
88+
&& rm -rf /var/lib/apt/lists/* \
89+
# Install multiple Composer versions
90+
&& cd /usr/local/bin \
91+
&& curl -sSL https://getcomposer.org/installer > composer-setup.php \
92+
&& curl -sSL https://composer.github.io/installer.sha384sum > composer-setup.sha384sum \
93+
&& sha384sum --check composer-setup.sha384sum \
94+
# Install Composer 2
95+
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer --2 \
96+
# Install Composer 1
97+
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer1 --1 \
98+
# Remove composer installer files.
99+
&& rm /usr/local/bin/composer-setup.php /usr/local/bin/composer-setup.sha384sum \
100+
&& mkdir -p /var/log/php \
101+
&& mkdir -p /var/log/supervisor
102+
103+
# Copy files
104+
COPY ./data/conf.d/php.ini /usr/local/etc/php/conf.d/xxx-optimode-default-php.ini
105+
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
106+
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
107+
108+
# User/Group
109+
RUN set -eux \
110+
&& groupadd -g ${MY_GID} -r ${MY_GROUP} \
111+
&& useradd -u ${MY_UID} -m -s /bin/bash -g ${MY_GROUP} ${MY_USER} \
112+
&& mkdir -p /var/lib/php/session \
113+
&& mkdir -p /var/lib/php/wsdlcache \
114+
&& chown -R ${MY_UID}:${MY_GROUP} /var/lib/php/session \
115+
&& chown -R ${MY_UID}:${MY_GROUP} /var/lib/php/wsdlcache
116+
117+
ARG URL
118+
ARG SOURCE
119+
ARG BUILD_DATE
120+
ARG AUTHORS
121+
ARG VENDOR
122+
ARG REVISION
123+
124+
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
125+
LABEL "org.opencontainers.image.title"="PHP 7.3 CLI"
126+
LABEL "org.opencontainers.image.description"="PHP 7.3 CLI with many extensions"
127+
LABEL "org.opencontainers.image.url"="$URL"
128+
LABEL "org.opencontainers.image.source"="$SOURCE"
129+
LABEL "org.opencontainers.image.version"="7.3"
130+
LABEL "org.opencontainers.image.revision"="$REVISION"
131+
LABEL "org.opencontainers.image.licenses"="MIT"
132+
LABEL "org.opencontainers.image.created"="$BUILD_DATE"
133+
LABEL "org.opencontainers.image.authors"="$AUTHORS"
134+
LABEL "org.opencontainers.image.vendor"="$VENDOR"
135+
LABEL "org.opencontainers.image.base.name"="php:7.3-cli"
136+
LABEL "org.opencontainers.image.ref.name"="7.3-cli"
137+
138+
EXPOSE 22
139+
WORKDIR /var/www/html
140+
CMD ["php", "-a"]
141+
ENTRYPOINT ["/docker-entrypoint.sh"]

0 commit comments

Comments
 (0)