Skip to content

Commit

Permalink
Upgrade to php 8.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
richarvey committed Mar 1, 2023
1 parent 9e13c83 commit 9c95629
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 167 deletions.
186 changes: 22 additions & 164 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,165 +1,23 @@
FROM php:8.1.12-fpm-alpine3.16
FROM php:8.2.3-fpm-alpine3.17

LABEL maintainer="Ric Harvey <ric@squarecows.com>"

ENV php_conf /usr/local/etc/php-fpm.conf
ENV fpm_conf /usr/local/etc/php-fpm.d/www.conf
ENV php_vars /usr/local/etc/php/conf.d/docker-vars.ini

ENV NGINX_VERSION 1.22.1
ENV LUA_MODULE_VERSION 0.10.22
ENV DEVEL_KIT_MODULE_VERSION 0.3.1
ENV LUAJIT_LIB=/usr/lib
ENV LUAJIT_INC=/usr/include/luajit-2.1

# resolves #166
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv

RUN GPG_KEYS=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
&& CONFIG="\
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--modules-path=/usr/lib/nginx/modules \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-http_xslt_module=dynamic \
--with-http_image_filter_module=dynamic \
# --with-http_geoip_module=dynamic \
--with-http_perl_module=dynamic \
--with-threads \
--with-stream \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-stream_realip_module \
# --with-stream_geoip_module=dynamic \
--with-http_slice_module \
--with-mail \
--with-mail_ssl_module \
--with-compat \
--with-file-aio \
--with-http_v2_module \
--add-module=/usr/src/ngx_devel_kit-$DEVEL_KIT_MODULE_VERSION \
--add-module=/usr/src/lua-nginx-module-$LUA_MODULE_VERSION \
" \
&& addgroup -S nginx \
&& adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
&& apk add --no-cache --virtual .build-deps \
autoconf \
gcc \
libc-dev \
make \
libressl-dev \
pcre-dev \
zlib-dev \
linux-headers \
curl \
gnupg \
libxslt-dev \
gd-dev \
# geoip-dev \
libmaxminddb-dev \
perl-dev \
luajit-dev \
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
&& curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v$DEVEL_KIT_MODULE_VERSION.tar.gz -o ndk.tar.gz \
&& curl -fSL https://github.com/openresty/lua-nginx-module/archive/v$LUA_MODULE_VERSION.tar.gz -o lua.tar.gz \
# && curl -fSL https://github.com/leev/ngx_http_geoip2_module/archive/$GEOIP2_MODULE_VERSION.tar.gz -o ngx_http_geoip2_module.tar.gz \
# && export GNUPGHOME="$(mktemp -d)" \
# && found=''; \
# for server in \
# ha.pool.sks-keyservers.net \
# hkp://keyserver.ubuntu.com:80 \
# hkp://p80.pool.sks-keyservers.net:80 \
# pgp.mit.edu \
# ; do \
# echo "Fetching GPG key $GPG_KEYS from $server"; \
# gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" && found=yes && break; \
# done; \
# test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \
# gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
#&& rm -r "$GNUPGHOME" nginx.tar.gz.asc \
&& mkdir -p /usr/src \
&& tar -zxC /usr/src -f nginx.tar.gz \
&& tar -zxC /usr/src -f ndk.tar.gz \
&& tar -zxC /usr/src -f lua.tar.gz \
# && tar -zxC /usr/src -f ngx_http_geoip2_module.tar.gz \
# && rm nginx.tar.gz ndk.tar.gz lua.tar.gz ngx_http_geoip2_module.tar.gz \
&& cd /usr/src/nginx-$NGINX_VERSION \
&& ./configure $CONFIG --with-debug \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& mv objs/nginx objs/nginx-debug \
&& mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \
&& mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \
# && mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \
&& mv objs/ngx_http_perl_module.so objs/ngx_http_perl_module-debug.so \
# && mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \
&& ./configure $CONFIG \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \
&& rm -rf /etc/nginx/html/ \
&& mkdir /etc/nginx/conf.d/ \
&& mkdir -p /usr/share/nginx/html/ \
&& install -m644 html/index.html /usr/share/nginx/html/ \
&& install -m644 html/50x.html /usr/share/nginx/html/ \
&& install -m755 objs/nginx-debug /usr/sbin/nginx-debug \
&& install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \
&& install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \
# && install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \
&& install -m755 objs/ngx_http_perl_module-debug.so /usr/lib/nginx/modules/ngx_http_perl_module-debug.so \
# && install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \
&& ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \
&& strip /usr/sbin/nginx* \
&& strip /usr/lib/nginx/modules/*.so \
&& rm -rf /usr/src/nginx-$NGINX_VERSION \
# && rm -rf /usr/src/ngx_http_geoip2_module-$GEOIP2_MODULE_VERSION \
\
# Bring in gettext so we can get `envsubst`, then throw
# the rest away. To do this, we need to install `gettext`
# then move `envsubst` out of the way so `gettext` can
# be deleted completely, then move `envsubst` back.
&& apk add --no-cache --virtual .gettext gettext \
&& mv /usr/bin/envsubst /tmp/ \
\
&& runDeps="$( \
scanelf --needed --nobanner /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --no-cache --virtual .nginx-rundeps $runDeps \
&& apk del .build-deps \
&& apk del .gettext \
&& mv /tmp/envsubst /usr/local/bin/ \
\
# forward request and error logs to docker log collector
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log

# INstall nginx + lua and devel kit
RUN apk add --no-cach nginx \
nginx-mod-http-lua \
nginx-mod-devel-kit

RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
echo /etc/apk/respositories && \
Expand All @@ -175,12 +33,9 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
git \
python3 \
py3-pip \
ca-certificates \
dialog \
autoconf \
make \
openssl-dev \
libressl-dev \
libzip-dev \
bzip2-dev \
icu-dev \
Expand All @@ -198,25 +53,29 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
sqlite-dev \
imap-dev \
libjpeg-turbo-dev \
postgresql-dev && \
docker-php-ext-configure gd \
postgresql-dev \
lua-resty-core

# Install PHP modules
RUN docker-php-ext-configure gd \
--enable-gd \
--with-freetype \
--with-jpeg && \
docker-php-ext-install gd && \
pip install --upgrade pip && \
#curl iconv session
#docker-php-ext-install pdo_mysql pdo_sqlite mysqli mcrypt gd exif intl xsl json soap dom zip opcache && \
# docker-php-ext-install iconv pdo_mysql pdo_sqlite pgsql pdo_pgsql mysqli gd exif intl xsl json soap dom zip opcache && \
docker-php-ext-install pdo_mysql mysqli pdo_sqlite pgsql pdo_pgsql exif intl xsl soap zip && \
pecl install xdebug-3.1.4 && \
pecl install -o -f redis && \
pecl install -o -f xdebug && \
pecl install -o -f redis && \
echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini && \
docker-php-source delete && \
mkdir -p /etc/nginx && \
mkdir -p /var/www/app && \
mkdir -p /run/nginx && \
mkdir -p /var/log/supervisor && \
echo "zend_extension=xdebug" > /usr/local/etc/php/conf.d/xdebug.ini && \
docker-php-source delete
# mkdir -p /etc/nginx && \
# mkdir -p /var/www/app && \
# mkdir -p /run/nginx && \


# Install composer and certbot
RUN mkdir -p /var/log/supervisor && \
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php composer-setup.php --quiet --install-dir=/usr/bin --filename=composer && \
rm composer-setup.php &&\
Expand All @@ -225,7 +84,6 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
mkdir -p /etc/letsencrypt/webrootauth && \
apk del gcc musl-dev linux-headers libffi-dev augeas-dev python3-dev make autoconf && \
apk del .sys-deps
# ln -s /usr/bin/php7 /usr/bin/php

ADD conf/supervisord.conf /etc/supervisord.conf

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ If you have improvements or suggestions please open an issue or pull request on
### Versioning
| Docker Tag | Git Release | Nginx Version | PHP Version | Alpine Version |
|-----|-------|-----|--------|--------|
| latest/2.2.0 | Master Branch |1.22.1 | 8.1.12 | 3.16 |
| latest/3.0.0 | Master Branch |1.22.1 | 8.2.3 | 3.17 |

For other tags please see: [versioning](https://github.com/richarvey/nginx-php-fpm/blob/master/docs/versioning.md)

Expand Down
10 changes: 8 additions & 2 deletions docs/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ We will use the [semver](http://ricostacruz.com/cheatsheets/semver.html) style n

The latest tag will always follow the master branch in git. the other versions will have releases attached.

#### PHP 8.x
#### PHP 8.2.x

| Docker Tag | PHP Version | Nginx Version | Alpine Version | Container Scripts | Notes |
|-----|-------|-----|--------|--------|----------|
| 2.2.0 | 8.1.12 |1.22.1 | 3.16 | 0.3.16 | nginx upgraded to 1.22.1 php to 8.1.12 |
| 3.0.0 | 8.2.3 |1.22.1 | 3.17 | 0.3.16 | upgraded php to 8.2.3 switched to packaged nginx |

#### PHP 8.1.x

| Docker Tag | PHP Version | Nginx Version | Alpine Version | Container Scripts | Notes |
|-----|-------|-----|--------|--------|----------|
| 2.2.1 | 8.1.12 |1.22.1 | 3.16 | 0.3.16 | nginx upgraded to 1.22.1 php to 8.1.12 |
| 2.1.4 | 8.1.9 |1.21.6 | 3.16 | 0.3.16 | nginx upgraded to 1.22.0 |
| 2.1.3 | 8.1.6 |1.22.0 | 3.15 | 0.3.16 | nginx upgraded to 1.22.0 |
| 2.1.2 | 8.1.6 |1.21.6 | 3.15 | 0.3.16 | mod lua upgraded to 0.10.17 |
Expand Down

0 comments on commit 9c95629

Please sign in to comment.