Skip to content

Commit

Permalink
Conversion from php8.0 version of this image
Browse files Browse the repository at this point in the history
  • Loading branch information
dancallan committed Oct 16, 2023
1 parent 2a33166 commit af65e29
Show file tree
Hide file tree
Showing 7 changed files with 733 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM uqlibrary/alpine:3.18.4

ENV COMPOSER_VERSION=2.2.22

COPY ./fs/docker-entrypoint.sh /usr/sbin/docker-entrypoint.sh

RUN apk upgrade --update --no-cache && \
apk add --update --no-cache \
ca-certificates \
curl \
bash \
git sqlite mysql-client libmemcached musl

RUN apk add --update --no-cache \
php82-session php82-soap php82-openssl php82-gmp php82-pdo_odbc php82-json php82-dom php82-pdo php82-zip \
php82-mysqli php82-sqlite3 php82-pdo_pgsql php82-bcmath php82-gd php82-odbc php82-pdo_mysql php82-pdo_sqlite \
php82-gettext php82-xmlreader php82-xmlwriter php82-xml php82-simplexml php82-bz2 php82-iconv php82-xsl php82-sodium \
php82-pdo_dblib php82-curl php82-ctype php82-pcntl php82-posix php82-phar php82-opcache php82-mbstring php82-zlib \
php82-fileinfo php82-tokenizer php82-sockets php82-phar php82-intl php82-ldap php82-phpdbg php82-fpm php82 \
#
# Install PHP8.2 extensions XDebug, igbinary and memcached using packaged PECL builds
&& apk add --update --no-cache php82-pecl-xdebug php82-pecl-igbinary php82-pecl-memcached \
#
# Add Postgresql Client
&& apk add --update --no-cache postgresql-client \
#
# Add MySQL/MariaDB Client Lib
&& apk add --update --no-cache mariadb-connector-c \
#
# Add media handling tools
&& apk add --update --no-cache exiftool mediainfo \
#
# Add generic symlinks for php8 binaries
&& ln -s phar82 /usr/bin/phar \
&& ln -s php82 /usr/bin/php \
&& ln -s phpdbg82 /usr/bin/phpdbg \
&& ln -s php-fpm82 /usr/sbin/php-fpm \
&& ln -s php82 /etc/php \
#
# Composer 2.x
&& curl -sS https://getcomposer.org/installer | php82 -- --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
#
# Remove build deps
&& rm -rf /var/cache/apk/* \
#
# Make scripts executable
&& chmod +x /usr/sbin/docker-entrypoint.sh

ADD fs /

ENTRYPOINT ["docker-entrypoint.sh"]

EXPOSE 9000

WORKDIR /app
9 changes: 9 additions & 0 deletions fs/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

if [ -f "/opt/bootstrap.sh" ]
then
chmod +x /opt/bootstrap.sh
/opt/bootstrap.sh
fi

exec /usr/sbin/php-fpm8 -R --nodaemonize
11 changes: 11 additions & 0 deletions fs/etc/php82/conf.d/00_opcache.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
zend_extension=opcache

opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.enable=1
opcache.validate_timestamps=0
opcache.max_wasted_percentage=10
6 changes: 6 additions & 0 deletions fs/etc/php82/conf.d/50-setting.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
date.timezone = "Australia/Brisbane"
short_open_tag = Off
session.auto_start = Off
magic_quotes_gpc = Off
register_globals = Off
memory_limit = 256M
12 changes: 12 additions & 0 deletions fs/etc/php82/conf.d/50_xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; Uncomment and configure mode https://xdebug.org/docs/all_settings#xdebug.mode
zend_extension=xdebug.so

xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.remote_handler=dbgp
xdebug.client_host=dbgpproxy
xdebug.client_port=9000
xdebug.idekey=PHPSTORM

; General
xdebug.max_nesting_level=1000
145 changes: 145 additions & 0 deletions fs/etc/php82/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

; All relative paths in this configuration file are relative to PHP's install
; prefix (/usr). This prefix can be dynamically changed by using the
; '-p' argument from the command line.

;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
; Pid file
; Note: the default prefix is /var
; Default Value: none
;pid = run/php-fpm82.pid

; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; into a local file.
; Note: the default prefix is /var
; Default Value: log/php82/error.log
;error_log = log/php82/error.log
error_log = /proc/self/fd/2

; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
; will be handled differently.
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
; Default Value: daemon
;syslog.facility = daemon

; syslog_ident is prepended to every message. If you have multiple FPM
; instances running on the same server, you can change the default value
; which must suit common needs.
; Default Value: php-fpm82
;syslog.ident = php-fpm82

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice
log_level = error

; Log limit on number of characters in the single line (log entry). If the
; line is over the limit, it is wrapped on multiple lines. The limit is for
; all logged characters including message prefix and suffix if present. However
; the new line character does not count into it as it is present only when
; logging to a file descriptor. It means the new line character is not present
; when logging to syslog.
; Default Value: 1024
;log_limit = 4096

; Log buffering specifies if the log line is buffered which means that the
; line is written in a single write operation. If the value is false, then the
; data is written directly into the file descriptor. It is an experimental
; option that can potentially improve logging performance and memory usage
; for some heavy logging scenarios. This option is ignored if logging to syslog
; as it has to be always buffered.
; Default value: yes
;log_buffering = no

; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0

; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated. This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;emergency_restart_interval = 0

; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;process_control_timeout = 0

; The maximum number of processes FPM will fork. This has been designed to control
; the global number of processes when using dynamic PM within a lot of pools.
; Use it with caution.
; Note: A value of 0 indicates no limit
; Default Value: 0
; process.max = 128

; Specify the nice(2) priority to apply to the master process (only if set)
; The value can vary from -19 (highest priority) to 20 (lowest priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool process will inherit the master process priority
; unless specified otherwise
; Default Value: no set
; process.priority = -19

; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
;daemonize = yes

; Set open file descriptor rlimit for the master process.
; Default Value: system defined value
;rlimit_files = 1024

; Set max core size rlimit for the master process.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0

; Specify the event mechanism FPM will use. The following is available:
; - select (any POSIX os)
; - poll (any POSIX os)
; - epoll (linux >= 2.5.44)
; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
; - /dev/poll (Solaris >= 7)
; - port (Solaris >= 10)
; Default Value: not set (auto detection)
;events.mechanism = epoll

; When FPM is built with systemd integration, specify the interval,
; in seconds, between health report notification to systemd.
; Set to 0 to disable.
; Available Units: s(econds), m(inutes), h(ours)
; Default Unit: seconds
; Default value: 10
;systemd_interval = 10

;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;

; Multiple pools of child processes may be started with different listening
; ports and different management options. The name of the pool will be
; used in logs and stats. There is no limitation on the number of pools which
; FPM can handle. Your system will tell you anyway :)

; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
; Relative path can also be used. They will be prefixed by:
; - the global prefix if it's been set (-p argument)
; - /usr otherwise
include=/etc/php82/php-fpm.d/*.conf
Loading

0 comments on commit af65e29

Please sign in to comment.