Skip to content

Commit

Permalink
move to php8.3 and go to nginx apk
Browse files Browse the repository at this point in the history
  • Loading branch information
Apfelwurm committed Sep 30, 2024
1 parent 8e35413 commit 725ba72
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 330 deletions.
24 changes: 2 additions & 22 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ updates:

# Enable version updates for Docker
- package-ecosystem: "docker"
target-branch: "php8.1"
target-branch: "php8.3"
directory: "/"
schedule:
interval: "daily"
Expand All @@ -16,27 +16,7 @@ updates:

# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
target-branch: "php8.1"
directory: "/"
schedule:
interval: "daily"


# Enable version updates for Docker
- package-ecosystem: "docker"
target-branch: "php8.2"
directory: "/"
schedule:
interval: "daily"
ignore:
- dependency-name: "*"
update-types: [ "version-update:semver-major" ]
- dependency-name: "*"
update-types: [ "version-update:semver-minor" ]

# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
target-branch: "php8.2"
target-branch: "php8.3"
directory: "/"
schedule:
interval: "daily"
59 changes: 11 additions & 48 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@ name: Test and Build
on:
push:
branches:
# - php8.1
- php8.2
- php8.3
pull_request:
branches:
# - php8.1
- php8.2
- php8.3
repository_dispatch: # Allows action to be triggered via webhook
workflow_dispatch: # Allows action to be run manually from the Actions tab


jobs:
build-docker:
# if: ${{ github.ref_name == 'php8.1' || github.base_ref == 'php8.1' || github.ref_name == 'php8.2' || github.base_ref == 'php8.2' }}
if: ${{ github.ref_name == 'php8.2' || github.base_ref == 'php8.2' }}
if: ${{ github.ref_name == 'php8.3' || github.base_ref == 'php8.3' }}
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
Expand All @@ -31,69 +28,35 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build 8.1 Linux Image
# if: ${{ github.event_name == 'pull_request' && (github.ref_name == 'php8.1' || github.base_ref == 'php8.1') }}
# uses: docker/[email protected]
# with:
# context: .
# file: ./Dockerfile
# platforms: linux/amd64,linux/arm/v7
# tags: |
# lan2play/docker-php-nginx-base:php8.1
# lan2play/docker-php-nginx-base:v3
# build-args: |
# BUILDNODE=GitHub (Run Number: ${{ github.run_number }} Run ID: ${{ github.run_id }})
# BUILDID=${{ github.run_id }}
# BUILDNUMBER=${{ github.run_number }}
# SOURCE_COMMIT=${{ github.sha }}
# no-cache: true
# push: false
# - name: Build and push 8.1 Linux Image
# if: ${{ github.event_name != 'pull_request' && (github.ref_name == 'php8.1' || github.base_ref == 'php8.1') }}
# uses: docker/[email protected]
# with:
# context: .
# file: ./Dockerfile
# platforms: linux/amd64,linux/arm/v7
# tags: |
# lan2play/docker-php-nginx-base:php8.1
# lan2play/docker-php-nginx-base:v3
# build-args: |
# BUILDNODE=GitHub (Run Number: ${{ github.run_number }} Run ID: ${{ github.run_id }})
# BUILDID=${{ github.run_id }}
# BUILDNUMBER=${{ github.run_number }}
# SOURCE_COMMIT=${{ github.sha }}
# no-cache: true
# push: true
- name: Build 8.2 Linux Image
if: ${{ github.event_name == 'pull_request' && (github.ref_name == 'php8.2' || github.base_ref == 'php8.2') }}
- name: Build 8.3 Linux Image
if: ${{ github.event_name == 'pull_request' && (github.ref_name == 'php8.3' || github.base_ref == 'php8.3') }}
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7
tags: |
lan2play/docker-php-nginx-base:latest
lan2play/docker-php-nginx-base:php8.2
lan2play/docker-php-nginx-base:v4
lan2play/docker-php-nginx-base:php8.3
lan2play/docker-php-nginx-base:v5
build-args: |
BUILDNODE=GitHub (Run Number: ${{ github.run_number }} Run ID: ${{ github.run_id }})
BUILDID=${{ github.run_id }}
BUILDNUMBER=${{ github.run_number }}
SOURCE_COMMIT=${{ github.sha }}
no-cache: true
push: false
- name: Build and push 8.2 Linux Image
if: ${{ github.event_name != 'pull_request' && (github.ref_name == 'php8.2' || github.base_ref == 'php8.2') }}
- name: Build and push 8.3 Linux Image
if: ${{ github.event_name != 'pull_request' && (github.ref_name == 'php8.3' || github.base_ref == 'php8.3') }}
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7
tags: |
lan2play/docker-php-nginx-base:latest
lan2play/docker-php-nginx-base:php8.2
lan2play/docker-php-nginx-base:v4
lan2play/docker-php-nginx-base:php8.3
lan2play/docker-php-nginx-base:v5
build-args: |
BUILDNODE=GitHub (Run Number: ${{ github.run_number }} Run ID: ${{ github.run_id }})
BUILDID=${{ github.run_id }}
Expand Down
119 changes: 5 additions & 114 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# FROM alpine:3.18 as builder
FROM php:8.2.11-fpm-alpine3.18 as builder
FROM php:8.3.12-fpm-alpine3.20 as builder
LABEL org.opencontainers.image.authors="Thornton Phillis ([email protected]), Alexader Volz ([email protected])"

# ENV - Config

ENV UUID 1000
ENV GUID 1000
ENV NGINX_VERSION 1.23.1
ENV PHP_VERSION 8.1.8
ENV NGINX_VERSION 1.26.2
ENV SUPERVISOR_LOG_ROOT /var/log/supervisor
ENV NGINX_DOCUMENT_ROOT /web/html

Expand Down Expand Up @@ -43,122 +41,15 @@ RUN apk add --no-cache supervisor \

# Install Nginx

RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
&& 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-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 \
" \
&& addgroup -S nginx \
RUN addgroup -S nginx \
&& adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
&& 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 \
&& pkill -9 gpg-agent; \
pkill -9 dirmngr; \
rm -rf "$GNUPGHOME" nginx.tar.gz.asc \
&& mkdir -p /usr/src \
&& tar -zxC /usr/src -f nginx.tar.gz \
&& rm nginx.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_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \
&& ./configure $CONFIG \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \
&& apk add --no-cache nginx \
&& 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_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 \
\
# 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 --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)" \
&& apk add --no-cache --virtual .nginx-rundeps $runDeps \
&& 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 PHP
# Install PHP exts
RUN docker-php-ext-configure gd --with-freetype --with-webp --with-jpeg && \
docker-php-ext-install mysqli pdo_mysql gd bcmath intl
RUN pecl install imagick
Expand Down
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
# Base image with PHP & Nginx for Eventula manager

- PHP8.2 - v4
- PHP8.3 - v5
- PHP8.2 - v4 - Unsupported
- PHP8.1 - v3 - Unsupported
- PHP8 - v2 - Unsupported
- PHP7 - v1 - Unsupported

docker buildx is require to build multiple archs

```docker buildx build --platform linux/amd64,linux/arm/v7 --no-cache --push -t lan2play/php-nginx-base:latest .```

## Notes

To allow for ArmV7 build you must run the commands below:

```docker run --rm --privileged docker/binfmt:820fdd95a9972a5308930a2bdfb8573dd4447ad3```
```docker run --privileged linuxkit/binfmt:v0.7```
```export DOCKER_CLI_EXPERIMENTAL=enabled```
```systemctl restart systemd-binfmt```
Loading

0 comments on commit 725ba72

Please sign in to comment.