Skip to content

Commit 59d3b75

Browse files
authored
Upgraded to php84 and some pipeline improvementes (#38)
* Upgraded to php84 and some pipeline improvementes * Rename master branch to main
1 parent bda29b5 commit 59d3b75

File tree

9 files changed

+49
-52
lines changed

9 files changed

+49
-52
lines changed

.github/workflows/build.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424
2525
if [[ $GITHUB_REF == refs/tags/* ]]; then
2626
TAGS="$TAGS,${GITHUB_REPOSITORY}:latest"
27-
elif [[ $VERSION == "master" ]]; then
27+
elif [[ $VERSION == "main" ]]; then
2828
TAGS="$TAGS,${GITHUB_REPOSITORY}:beta"
2929
fi
3030
3131
GHCR_TAGS="${GHCR_IMAGE}:${VERSION}"
3232
if [[ $GITHUB_REF == refs/tags/* ]]; then
3333
GHCR_TAGS="$GHCR_TAGS,${GHCR_IMAGE}:latest"
34-
elif [[ $VERSION == "master" ]]; then
34+
elif [[ $VERSION == "main" ]]; then
3535
GHCR_TAGS="$GHCR_TAGS,${GHCR_IMAGE}:beta"
3636
fi
3737
@@ -76,18 +76,19 @@ jobs:
7676
docker compose version
7777
docker compose --file docker-compose.test.yml up --exit-code-from sut --timeout 10 --build
7878
79-
# Step 8: Build and Push (if not a PR)
79+
# Step 8: Build and Push to DockerHub
8080
- name: Build and push
81+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
8182
uses: docker/build-push-action@v6
8283
with:
8384
context: .
84-
push: ${{ github.event_name != 'pull_request' }}
85+
push: true
8586
tags: ${{ steps.prepare.outputs.tags }}
8687
platforms: ${{ steps.prepare.outputs.platforms }}
8788

8889
# Step 9: Push to GitHub Container Registry
8990
- name: Push to GHCR
90-
if: github.event_name != 'pull_request'
91+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
9192
uses: docker/build-push-action@v6
9293
with:
9394
context: .

Dockerfile

+29-29
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,35 @@ LABEL Maintainer="Ernesto Serrano <[email protected]>" \
66

77
# Install packages
88
RUN apk --no-cache add \
9-
php83 \
10-
php83-ctype \
11-
php83-curl \
12-
php83-dom \
13-
php83-exif \
14-
php83-fileinfo \
15-
php83-fpm \
16-
php83-gd \
17-
php83-iconv \
18-
php83-intl \
19-
php83-json \
20-
php83-mbstring \
21-
php83-mysqli \
22-
php83-opcache \
23-
php83-openssl \
24-
php83-pecl-apcu \
25-
php83-pdo \
26-
php83-pdo_mysql \
27-
php83-pgsql \
28-
php83-phar \
29-
php83-session \
30-
php83-simplexml \
31-
php83-soap \
32-
php83-sodium \
33-
php83-tokenizer \
34-
php83-xml \
35-
php83-xmlreader \
36-
php83-zip \
37-
php83-zlib \
9+
php84 \
10+
php84-ctype \
11+
php84-curl \
12+
php84-dom \
13+
php84-exif \
14+
php84-fileinfo \
15+
php84-fpm \
16+
php84-gd \
17+
php84-iconv \
18+
php84-intl \
19+
php84-json \
20+
php84-mbstring \
21+
php84-mysqli \
22+
php84-opcache \
23+
php84-openssl \
24+
php84-pecl-apcu \
25+
php84-pdo \
26+
php84-pdo_mysql \
27+
php84-pgsql \
28+
php84-phar \
29+
php84-session \
30+
php84-simplexml \
31+
php84-soap \
32+
php84-sodium \
33+
php84-tokenizer \
34+
php84-xml \
35+
php84-xmlreader \
36+
php84-zip \
37+
php84-zlib \
3838
nginx \
3939
runit \
4040
curl \

README.md

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
# Docker PHP-FPM 8.3 & Nginx 1.26 on Alpine Linux 3.20
1+
# Docker PHP-FPM 8.4 & Nginx 1.26 on Alpine Linux 3.21
22

33
[![Docker Pulls](https://img.shields.io/docker/pulls/erseco/alpine-php-webserver.svg)](https://hub.docker.com/r/erseco/alpine-php-webserver/)
44
![Docker Image Size](https://img.shields.io/docker/image-size/erseco/alpine-php-webserver)
5-
![alpine 3.20](https://img.shields.io/badge/alpine-3.20-brightgreen.svg)
6-
![nginx 1.26.0](https://img.shields.io/badge/nginx-1.26-brightgreen.svg)
7-
![php 8.3](https://img.shields.io/badge/php-8.3-brightgreen.svg)
5+
![alpine 3.21](https://img.shields.io/badge/alpine-3.21-brightgreen.svg)
6+
![nginx 1.26.2-r3](https://img.shields.io/badge/nginx-1.26.2-r3-brightgreen.svg)
7+
![php 8.4](https://img.shields.io/badge/php-8.4-brightgreen.svg)
88
![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)
99

10-
Example PHP-FPM 8.3 & Nginx 1.26 setup for Docker, build on [Alpine Linux](https://www.alpinelinux.org/).
10+
Example PHP-FPM 8.4 & Nginx 1.26 setup for Docker, build on [Alpine Linux](https://www.alpinelinux.org/).
1111
The image is only +/- 25MB large.
1212

1313
Repository: https://github.com/erseco/alpine-php-webserver
1414

1515
* Built on the lightweight and secure Alpine Linux distribution
1616
* Very small Docker image size (+/-25MB)
17-
* Uses PHP 8.3 for better performance, lower cpu usage & memory footprint
17+
* Uses PHP 8.4 for better performance, lower cpu usage & memory footprint
1818
* Multi-arch support: 386, amd64, arm/v6, arm/v7, arm64, ppc64le, s390x
1919
* Optimized for 100 concurrent users
2020
* Optimized to only use resources when there's traffic (by using PHP-FPM's ondemand PM)
2121
* Use of runit instead of supervisord to reduce memory footprint
2222
* The servers Nginx, PHP-FPM run under a non-privileged user (nobody) to make it more secure
2323
* The logs of all the services are redirected to the output of the Docker container (visible with `docker logs -f <container name>`)
2424
* Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust the image to your needs
25-
* Also availabe in Apache flavour: `erseco/alpine-php-webserver:apache`
26-
2725

2826
## Usage
2927

@@ -46,8 +44,6 @@ Easily serve your local PHP files using Docker Compose. This setup mounts your `
4644
Here's a simple `docker-compose.yml` example to get you started:
4745

4846
```yaml
49-
version: '3.8'
50-
5147
services:
5248
webserver:
5349
image: erseco/alpine-php-webserver

docker-compose.test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
version: '3.5'
1+
---
22
services:
33
app:
44
build: .
55
sut:
6-
image: alpine:3.21
6+
image: alpine:latest
77
depends_on:
88
- app
99
command: /tmp/run_tests.sh

rootfs/bin/docker-entrypoint.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ mv "$tmpfile" /etc/nginx/nginx.conf
2929

3030
# Replace ENV vars in php configuration files
3131
tmpfile=$(mktemp)
32-
cat /etc/php83/conf.d/custom.ini | envsubst "$(env | cut -d= -f1 | sed -e 's/^/$/')" | tee "$tmpfile" > /dev/null
33-
mv "$tmpfile" /etc/php83/conf.d/custom.ini
32+
cat /etc/php84/conf.d/custom.ini | envsubst "$(env | cut -d= -f1 | sed -e 's/^/$/')" | tee "$tmpfile" > /dev/null
33+
mv "$tmpfile" /etc/php84/conf.d/custom.ini
3434

3535
tmpfile=$(mktemp)
36-
cat /etc/php83/php-fpm.d/www.conf | envsubst "$(env | cut -d= -f1 | sed -e 's/^/$/')" | tee "$tmpfile" > /dev/null
37-
mv "$tmpfile" /etc/php83/php-fpm.d/www.conf
36+
cat /etc/php84/php-fpm.d/www.conf | envsubst "$(env | cut -d= -f1 | sed -e 's/^/$/')" | tee "$tmpfile" > /dev/null
37+
mv "$tmpfile" /etc/php84/php-fpm.d/www.conf
3838

3939
echo "Starting startup scripts in /docker-entrypoint-init.d ..."
4040
for script in $(find /docker-entrypoint-init.d/ -executable -type f | sort); do
File renamed without changes.
File renamed without changes.

rootfs/etc/service/php/run

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
# pipe stderr to stdout and run php-fpm
44
exec 2>&1
5-
exec php-fpm83 -F
5+
exec php-fpm84 -F

run_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env sh
22
apk --no-cache add curl
3-
curl --silent --fail http://app:8080 | grep 'PHP 8.3'
3+
curl --silent --fail http://app:8080 | grep 'PHP 8.4'

0 commit comments

Comments
 (0)