Skip to content

Commit

Permalink
feat: add php8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
11ze committed Apr 6, 2024
1 parent 4a30063 commit c5a2afe
Show file tree
Hide file tree
Showing 18 changed files with 7,803 additions and 0 deletions.
Empty file added crontabs/php83/.keep
Empty file.
2 changes: 2 additions & 0 deletions data/composer83/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
26 changes: 26 additions & 0 deletions docker-compose.11ze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ services:
#default:
# ipv4_address: 10.0.0.10

php83:
build:
context: ./services/php83
args:
PHP_VERSION: php:${PHP83_VERSION}-fpm-alpine
CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
COMPOSER_URL: ${COMPOSER_URL}
PHP_EXTENSIONS: ${PHP83_EXTENSIONS}
INSTALL_APPS: ${PHP_INSTALL_APPS}
TZ: '$TZ'
container_name: php83
volumes:
- ${SOURCE_DIR}:/www/:rw
- ${PHP83_PHP_CONF_FILE}:/usr/local/etc/php/php.ini:ro
- ${PHP83_FPM_CONF_FILE}:/usr/local/etc/php-fpm.d/www.conf:rw
- ${PHP83_LOG_DIR}:/var/log/php
- ${DATA_DIR}/composer83:/tmp/composer
- ${PHP_SSH_DIR}:/root/.ssh
- ${FONT_DIR}:/usr/share/fonts/custom:r
- ${PHP83_CRONTABS}:/etc/crontabs/:rw
restart: always
cap_add:
- SYS_PTRACE
networks:
- default

php82:
build:
context: ./services/php82
Expand Down
25 changes: 25 additions & 0 deletions env.11ze
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,31 @@ PHP_INSTALL_APPS=git,openssh
# ssh 映射目录, composer 私有包使用 [email protected] 则需要将 ~/.ssh/id_rsa 复制到 ./data/ssh/ 目录下。直接映射 ~/.ssh也可以。没有则请忽略
PHP_SSH_DIR=./data/ssh

# PHP83
#
# Available PHP_EXTENSIONS:
#
# pdo_mysql,zip,pcntl,mysqli,mbstring,exif,bcmath,calendar,
# sockets,gettext,shmop,sysvmsg,sysvsem,sysvshm,pdo_rebird,
# pdo_dblib,pdo_oci,pdo_odbc,pdo_pgsql,pgsql,oci8,odbc,dba,
# gd,intl,bz2,soap,xsl,xmlrpc,wddx,curl,readline,snmp,pspell,
# recode,tidy,gmp,imap,ldap,imagick,sqlsrv,mcrypt,opcache,
# redis,memcached,xdebug,swoole,pdo_sqlsrv,sodium,yaf,mysql,
# amqp,mongodb,event,rar,ast,yac,yar,yaconf,msgpack,igbinary,
# seaslog,varnish,xhprof,xlswriter,memcache,rdkafka,zookeeper,
# psr,phalcon,sdebug,ssh2,yaml,protobuf,hprose
#
# You can let it empty to avoid installing any extensions,
# or install multi plugins as:
# PHP_EXTENSIONS=pdo_mysql,mysqli,gd,curl,opcache
#
PHP83_VERSION=8.3
PHP83_PHP_CONF_FILE=./services/php83/php.ini
PHP83_FPM_CONF_FILE=./services/php83/php-fpm.conf
PHP83_LOG_DIR=./logs/php83
PHP83_EXTENSIONS=pdo_mysql,mysqli,mbstring,gd,curl,opcache,pdo_pgsql,zip,bcmath,mbstring,redis,mcrypt,xdebug
PHP83_CRONTABS=./crontabs/php83

# PHP82
#
# Available PHP_EXTENSIONS:
Expand Down
2 changes: 2 additions & 0 deletions logs/php83/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
60 changes: 60 additions & 0 deletions services/php83/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
ARG PHP_VERSION
FROM surnet/alpine-wkhtmltopdf:3.19.1-0.12.6-full as wkhtmltopdf
FROM ${PHP_VERSION}

ARG TZ
ARG PHP_EXTENSIONS
ARG CONTAINER_PACKAGE_URL
ARG COMPOSER_URL

RUN if [ "${CONTAINER_PACKAGE_URL}" != "" ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi

COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions

RUN chmod +x install.sh \
&& sh install.sh \
&& rm -rf /tmp/extensions

ADD ./extensions/install-php-extensions /usr/local/bin/

RUN chmod uga+x /usr/local/bin/install-php-extensions

RUN apk --no-cache add tzdata \
# 下面这部分是 wkhtmltopdf 需要的依赖
libstdc++ \
libx11 \
libxrender \
libxext \
libssl3 \
ca-certificates \
fontconfig \
freetype \
ttf-droid \
ttf-freefont \
ttf-liberation \
# ttf-dejavu \ # 中文字体,但还是使用下面 front/* 的中文字体
# && rm -rf /var/cache/apk/* \
# 上面这部分是 wkhtmltopdf 需要的依赖
libreoffice \
mysql-client \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone


# Fix: https://github.com/docker-library/php/issues/240
RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php


# Install composer and change it's cache home
RUN curl -o /usr/bin/composer https://${COMPOSER_URL}/composer/composer.phar \
&& chmod +x /usr/bin/composer
ENV COMPOSER_HOME=/tmp/composer

# php image's www-data user uid & gid are 82, change them to 1000 (primary user)
RUN apk --no-cache add shadow && usermod -u 1000 www-data && groupmod -g 1000 www-data

COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/libwkhtmltox.so /bin/

WORKDIR /www
Binary file added services/php83/extensions/event-3.0.8.tgz
Binary file not shown.
Binary file added services/php83/extensions/imagick-3.7.0.tgz
Binary file not shown.
Loading

0 comments on commit c5a2afe

Please sign in to comment.