Skip to content

Commit 7fd5566

Browse files
committed
Fix README and FrankenPHP source tag
1 parent b4d0884 commit 7fd5566

File tree

35 files changed

+228
-126
lines changed

35 files changed

+228
-126
lines changed

README.md

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,32 +54,32 @@ You can simply copy and paste one of these `docker run` commands to run a contai
5454

5555
```shell
5656
# non-interactive
57-
docker run --rm shinsenter/php:8.3-cli php -m
57+
docker run shinsenter/php:8.3-cli php -m
5858

5959
# interactive
60-
docker run -it --rm -v ./myproject:/var/www/html shinsenter/php:8.3-cli
60+
docker run -it -v ./myproject:/var/www/html shinsenter/php:8.3-cli
6161
```
6262

6363
#### PHP-FPM
6464

6565
```shell
66-
docker run --rm -v ./myproject:/var/www/html -p 9000:9000 shinsenter/php:8.3-fpm
66+
docker run -v ./myproject:/var/www/html -p 9000:9000 shinsenter/php:8.3-fpm
6767
```
6868

6969
#### PHP-FPM + Nginx (or Apache, FrankenPHP, Nginx Unit)
7070

7171
```shell
7272
# with Nginx
73-
docker run --rm -v ./myproject:/var/www/html -p 80:80 -p 443:443 shinsenter/php:8.3-fpm-nginx
73+
docker run -v ./myproject:/var/www/html -p 80:80 -p 443:443 shinsenter/php:8.3-fpm-nginx
7474

7575
# with Apache
76-
docker run --rm -v ./myproject:/var/www/html -p 80:80 -p 443:443 shinsenter/php:8.3-fpm-apache
76+
docker run -v ./myproject:/var/www/html -p 80:80 -p 443:443 shinsenter/php:8.3-fpm-apache
7777

7878
# with FrankenPHP
79-
docker run --rm -v ./myproject:/var/www/html -p 80:80 -p 443:443 shinsenter/php:8.3-frankenphp
79+
docker run -v ./myproject:/var/www/html -p 80:80 -p 443:443 shinsenter/php:8.3-frankenphp
8080

8181
# with Nginx Unit
82-
docker run --rm -v ./myproject:/var/www/html -p 80:80 -p 443:443 shinsenter/php:8.3-unit-php
82+
docker run -v ./myproject:/var/www/html -p 80:80 -p 443:443 shinsenter/php:8.3-unit-php
8383
```
8484

8585
## Customizing Settings via Environment Variables
@@ -102,7 +102,7 @@ This naming convention helps you easily identify which environment variable appl
102102
#### Command Line
103103

104104
```shell
105-
docker run --rm \
105+
docker run \
106106
-v ./myproject:/var/www/html \
107107
-e PHP_DISPLAY_ERRORS='1' \
108108
-e PHP_POST_MAX_SIZE='100M' \
@@ -162,7 +162,7 @@ zip
162162

163163
> 👉🏻 Info: The pre-installed PHP extensions from the official Docker images are excluded from this list.
164164

165-
> 💡 Hint: Run `docker run --rm shinsenter/php:8.3-cli php -m` in the container
165+
> 💡 Hint: Run `docker run shinsenter/php:8.3-cli php -m` in the container
166166
to get a list of extensions (you can replace `8.3` with a specific PHP version).
167167

168168
## Adding PHP Extensions
@@ -193,7 +193,7 @@ have a look at [the install-php-extensions project](https://github.com/mlocati/d
193193
The default application directory is `/var/www/html` and can be customized via the `$APP_PATH` environment variable:
194194

195195
```shell
196-
docker run --rm -p 80:80 -p 443:443 -p 443:443/udp \
196+
docker run -p 80:80 -p 443:443 -p 443:443/udp \
197197
-v "$PWD":/app \
198198
-e APP_PATH=/app \
199199
shinsenter/php:8.3-fpm-nginx
@@ -206,7 +206,7 @@ Moreover, the default document root
206206
can be customized by setting the `$DOCUMENT_ROOT` environment variable:
207207

208208
```shell
209-
docker run --rm -p 80:80 -p 443:443 -p 443:443/udp \
209+
docker run -p 80:80 -p 443:443 -p 443:443/udp \
210210
-v "$PWD":/app \
211211
-e APP_PATH=/app \
212212
-e DOCUMENT_ROOT=/public \
@@ -234,7 +234,7 @@ The available variables are:
234234

235235
For example, to run a container as the user `myapp` with uid `5000`, you could do:
236236
```shell
237-
docker run --rm -p 80:80 -p 443:443 -p 443:443/udp \
237+
docker run -p 80:80 -p 443:443 -p 443:443/udp \
238238
-e APP_USER=myapp \
239239
-e APP_UID=5000 \
240240
shinsenter/php:8.3-fpm-nginx
@@ -260,16 +260,19 @@ The autorun feature saves time by executing initialization scripts without manua
260260

261261
#### Usage
262262

263-
For example, a script called `00-copy-config` could be copied into `/startup/` via a Dockerfile.
263+
For example, a script called `00-migration` could be copied into `/startup/` via a Dockerfile.
264264

265265
> Note: The script file must have executable permissions to run.
266266

267267
```Dockerfile
268268
FROM shinsenter/php:8.3-cli
269269
270-
ADD ./application /var/www/html
271-
ADD ./autorun/00-copy-config /startup/00-copy-config
272-
RUN chmod +x /startup/00-copy-config
270+
ADD ./autorun/00-migration /startup/00-migration
271+
RUN chmod +x /startup/00-migration
272+
273+
# You may add your constructions from here
274+
# For example:
275+
# ADD --chown=$APP_USER:$APP_GROUP ./myproject/ /var/www/html/
273276
```
274277

275278
> 👉🏻 Info: The startup directory already includes a script called `99-greeting` that prints a welcome message when the container starts:
@@ -289,12 +292,12 @@ DockerHub: https://docker.shin.company/php
289292
(To edit this welcome message, add your text to /etc/welcome.txt)
290293

291294
----------------------------------------
292-
Container : shinsenter/php
293-
Distro : Alpine Linux v3.19
294-
Timezone : UTC (GMT+0000)
295-
UID / GID : www-data:www-data (82:82)
296-
App Root : /var/www/html
297-
Document Root : /var/www/html/public
295+
Container : shinsenter/php
296+
Distro : Debian GNU/Linux 12 (bookworm)
297+
Timezone : UTC (GMT+0000)
298+
UID / GID : www-data:www-data (33:33)
299+
App Root : /var/www/html
300+
Document Root : /var/www/html
298301
----------------------------------------
299302

300303
PHP Docker Images (https://hub.docker.com/r/shinsenter/php)
@@ -307,11 +310,11 @@ but WITHOUT ANY WARRANTY. See the GNU GPL for more details.
307310

308311
To get support, please contact: SHIN (@shinsenter)
309312

310-
PHP 8.3.3 (fpm-fcgi) (built: Feb 16 2024 23:20:45)
313+
PHP 8.3.9 (cli) (built: Jul 6 2024 00:42:01) (NTS)
311314
Copyright (c) The PHP Group
312-
Zend Engine v4.3.3, Copyright (c) Zend Technologies
313-
with Zend OPcache v8.3.3, Copyright (c), by Zend Technologies
314-
Composer version 2.7.1 2024-02-09 15:26:28
315+
Zend Engine v4.3.9, Copyright (c) Zend Technologies
316+
with Zend OPcache v8.3.9, Copyright (c), by Zend Technologies
317+
Composer version 2.7.7 2024-06-10 22:11:12
315318
```
316319
317320
#### Disable autorun scripts
@@ -320,7 +323,7 @@ To disable autorunning scripts, set the `DISABLE_AUTORUN_SCRIPTS` environment va
320323
321324
For example, you can do this with `docker run`:
322325
```shell
323-
docker run --rm -e DISABLE_AUTORUN_SCRIPTS=1 shinsenter/php:8.3-fpm-nginx
326+
docker run -e DISABLE_AUTORUN_SCRIPTS=1 shinsenter/php:8.3-fpm-nginx
324327
```
325328

326329
Or in a `docker-compose.yml`:
@@ -344,7 +347,7 @@ This works both with `docker run` and in `docker-compose.yml`.
344347
#### Command Line
345348

346349
```shell
347-
docker run --rm -e DEBUG=1 shinsenter/php:8.3-fpm-nginx
350+
docker run -e DEBUG=1 shinsenter/php:8.3-fpm-nginx
348351
```
349352

350353
#### docker-compose.yml

build/config.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ with-f8p)
141141
PREFIX="frankenphp"
142142
BUILD_NAME="shinsenter/frankenphp"
143143
S6_VERSION="latest"
144-
BUILD_SOURCE_IMAGE="dunglas/frankenphp:$(get_dockerhub_latest_tag "dunglas/frankenphp" 1 "1-php$PHP_VERSION$SUFFIX")"
144+
BUILD_SOURCE_IMAGE="dunglas/frankenphp:1-php$PHP_VERSION$SUFFIX"
145145
BUILD_DOCKERFILE=$BASE_DIR/src/php/with-f8p.dockerfile
146146
BUILD_PLATFORM="linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8"
147147
BUILD_CACHE_KEY="frankenphp@$(get_dockerhub_latest_sha "dunglas/frankenphp" 1 "1-php$PHP_VERSION$SUFFIX" | head -c17)"
@@ -191,7 +191,6 @@ app-*)
191191
;;
192192
grav)
193193
# https://learn.getgrav.org/17/basics/installation
194-
LATEST_PHP="8.1"
195194
verlt "$PHP_VERSION" "7.3" && SKIP_BUILD=1
196195
;;
197196
hyperf)
@@ -219,7 +218,7 @@ app-*)
219218
mautic)
220219
# https://docs.mautic.org/en/5.x/getting_started/how_to_install_mautic.html#installing-with-composer
221220
LATEST_PHP="8.1"
222-
verlt "$PHP_VERSION" "8.0" && SKIP_BUILD=1
221+
verlt "$PHP_VERSION" "7.4" && SKIP_BUILD=1
223222
;;
224223
phpixie)
225224
# https://phpixie.com/quickstart.html

src/php/base-os.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,37 @@ Build the following Dockerfile and try it out:
2929
```Dockerfile
3030
FROM shinsenter/ubuntu-s6:latest
3131

32-
# Add your instructions here
33-
# E.g. ADD ./your-project/src/ /var/www/html/
32+
# You may add your constructions from here
33+
# For example:
34+
# ADD --chown=$APP_USER:$APP_GROUP ./myproject/ /var/www/html/
3435
```
3536

3637
#### Debian
3738

3839
```Dockerfile
3940
FROM shinsenter/debian-s6:latest
4041

41-
# Add your instructions here
42-
# E.g. ADD ./your-project/src/ /var/www/html/
42+
# You may add your constructions from here
43+
# For example:
44+
# ADD --chown=$APP_USER:$APP_GROUP ./myproject/ /var/www/html/
4345
```
4446

4547
#### Alpine
4648

4749
```Dockerfile
4850
FROM shinsenter/alpine-s6:latest
4951

50-
# Add your instructions here
51-
# E.g. ADD ./your-project/src/ /var/www/html/
52+
# You may add your constructions from here
53+
# For example:
54+
# ADD --chown=$APP_USER:$APP_GROUP ./myproject/ /var/www/html/
5255
```
5356

5457
## Application Directory
5558

5659
The default application directory is `/var/www/html` and can be customized via the `$APP_PATH` environment variable:
5760

5861
```shell
59-
docker run --rm -v "$PWD":/app \
62+
docker run -v "$PWD":/app \
6063
-e APP_PATH=/app \
6164
shinsenter/ubuntu-s6:latest
6265
```
@@ -79,7 +82,7 @@ The available variables are:
7982

8083
For example, to run a container as user `myapp` with uid `5000`, you could do:
8184
```shell
82-
docker run --rm \
85+
docker run \
8386
-e APP_USER=myapp \
8487
-e APP_UID=5000 \
8588
shinsenter/ubuntu-s6:latest
@@ -103,15 +106,15 @@ This mechanism can be used to initialize projects before the main program on the
103106

104107
#### Usage
105108

106-
For example, a script called `00-copy-config` could be copied into `/startup/` via a Dockerfile.
109+
For example, a script called `00-migration` could be copied into `/startup/` via a Dockerfile.
107110

108111
> Note: The script file must have executable permissions to run.
109112

110113
```Dockerfile
111114
FROM shinsenter/ubuntu-s6:latest
112115
113-
ADD ./autorun/00-copy-config /startup/00-copy-config
114-
RUN chmod +x /startup/00-copy-config
116+
ADD ./autorun/00-migration /startup/00-migration
117+
RUN chmod +x /startup/00-migration
115118
```
116119

117120
> 👉🏻 Info: The startup directory already includes a script called `99-greeting` that prints a welcome message when container starts.
@@ -122,7 +125,7 @@ To disable autorunning scripts, set `DISABLE_AUTORUN_SCRIPTS=1` as an environmen
122125

123126
For example, this can be done with docker run:
124127
```shell
125-
docker run --rm -e DISABLE_AUTORUN_SCRIPTS=1 shinsenter/ubuntu-s6:latest bash
128+
docker run -e DISABLE_AUTORUN_SCRIPTS=1 shinsenter/ubuntu-s6:latest bash
126129
```
127130

128131
Or in a `docker-compose.yml`:
@@ -145,7 +148,7 @@ This works both with `docker run` and in `docker-compose.yml`.
145148
#### Command Line
146149

147150
```shell
148-
docker run --rm -e DEBUG=1 shinsenter/ubuntu-s6:latest bash
151+
docker run -e DEBUG=1 shinsenter/ubuntu-s6:latest bash
149152
```
150153

151154
#### docker-compose.yml

src/php/common/rootfs/startup/99-greeting

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ Document Root : $(app-root)
2323
$([ -f $LICENSE_TXT ] && cat $LICENSE_TXT | sed "s#%EMAIL%#$EMAIL#g" | sed "s#%YEAR%#$YEAR#g")
2424
2525
$(if has-cmd php-fpm; then php-fpm -v; elif has-cmd php; then php -v; fi)
26-
$(if has-cmd composer; then composer -V; fi)
26+
$(if has-cmd composer; then composer -V 2>&1 | head -n1; fi)
2727
"
2828
fi

src/php/with-apache.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ allowing you to get started with your projects faster without additional install
1616
## Usage
1717

1818
```shell
19-
docker run --rm -p 80:80 -p 443:443 -p 443:443/udp \
19+
docker run -p 80:80 -p 443:443 -p 443:443/udp \
2020
-v ./myproject:/var/www/html \
2121
shinsenter/phpfpm-apache:latest
2222
```
@@ -52,7 +52,7 @@ COPY my_site.key /etc/ssl/site/server.key
5252
#### Using docker run
5353

5454
```shell
55-
docker run --rm -p 80:80 -p 443:443 -p 443:443/udp \
55+
docker run -p 80:80 -p 443:443 -p 443:443/udp \
5656
-v ./myproject:/var/www/html \
5757
-v ./my_site.crt:/etc/ssl/site/server.crt \
5858
-v ./my_site.key:/etc/ssl/site/server.key \

src/php/with-apache/rootfs/etc/apache2/apache2.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ Timeout 60
182182
Options -Indexes +FollowSymLinks +MultiViews
183183
</Directory>
184184

185+
# enable CORS for web fonts
186+
<FilesMatch "\.(ttf|ttc|otf|eot|woff2?)$">
187+
Header set Access-Control-Allow-Origin "*"
188+
</FilesMatch>
189+
185190
# For any files that match PHP, pass it to PHP-FPM for processing
186191
<FilesMatch "\.php$">
187192
ProxyFCGIBackendType GENERIC

src/php/with-f8p.dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ HEALTHCHECK CMD curl -sf http://localhost:2019/metrics || exit 1
3232

3333
################################################################################
3434

35+
ARG BUILD_SOURCE_IMAGE
36+
LABEL build_from="$BUILD_SOURCE_IMAGE"
3537
LABEL traefik.enable=true

src/php/with-f8p.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ allowing you to get started with your projects faster without additional install
1616
## Usage
1717

1818
```shell
19-
docker run --rm -p 80:80 -p 443:443 -p 443:443/udp \
19+
docker run -p 80:80 -p 443:443 -p 443:443/udp \
2020
-v ./myproject:/var/www/html \
2121
shinsenter/frankenphp:latest
2222
```
@@ -52,7 +52,7 @@ COPY my_site.key /etc/ssl/site/server.key
5252
#### Using docker run
5353

5454
```shell
55-
docker run --rm -p 80:80 -p 443:443 -p 443:443/udp \
55+
docker run -p 80:80 -p 443:443 -p 443:443/udp \
5656
-v ./myproject:/var/www/html \
5757
-v ./my_site.crt:/etc/ssl/site/server.crt \
5858
-v ./my_site.key:/etc/ssl/site/server.key \

src/php/with-f8p/f8p-config.dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ env-default CADDY_GLOBAL_OPTIONS ''
2525
env-default CADDY_EXTRA_CONFIG ''
2626
env-default CADDY_SERVER_EXTRA_DIRECTIVES ''
2727

28+
if [ -f /etc/caddy/Caddyfile ]; then
29+
frankenphp fmt --overwrite /etc/caddy/Caddyfile
30+
fi
31+
2832
# create s6 services
2933
if has-cmd s6-service; then
3034
s6-service frankenphp longrun '#!/usr/bin/env sh
35+
3136
if [ -f /etc/caddy/envvars ]; then
3237
source /etc/caddy/envvars
3338
fi

src/php/with-f8p/f8p-install.dockerfile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@ echo 'Install FrankenPHP'
1717

1818
set -e
1919

20-
# phpaddmod sockets swoole
21-
22-
if has-cmd frankenphp; then
23-
ln -nsf "$(command -v frankenphp)" /usr/local/sbin/caddy
20+
if ! has-cmd frankenphp; then
21+
exit 1
2422
fi
2523

2624
if has-cmd setcap; then
27-
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp
25+
setcap cap_net_bind_service=+ep "$(command -v frankenphp)"
2826
fi
2927

30-
if [ -x "$LEGACY_ENTRYPOINT" ]; then
31-
sed -i 's|php|frankenphp run|g' "$LEGACY_ENTRYPOINT"
32-
fi
28+
ln -nsf "$(command -v frankenphp)" /usr/local/sbin/caddy
29+
30+
frankenphp version
3331
EOF

0 commit comments

Comments
 (0)