From 7a8422f208915e7c43d4acb11169a97a66081e37 Mon Sep 17 00:00:00 2001 From: paspo Date: Sun, 15 Dec 2024 09:39:25 +0100 Subject: [PATCH] puid and pgid support --- Dockerfile | 4 +++- README.md | 4 ++++ rootfs/app/entrypoint.sh | 9 +++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 44d61a9..81f71be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,8 @@ VOLUME [ "/data/www", "/ssh" ] ENV \ USERNAME=theuser \ - PHP=none + PHP=none \ + PUID=1000 \ + PGID=1000 ENTRYPOINT [ "/sbin/tini", "/app/entrypoint.sh" ] diff --git a/README.md b/README.md index a43e82f..a2b8948 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,8 @@ services: - ./ssh:/ssh # add authorized_keys file here environment: PHP: php84 # none (default), php82, php83, php84 + PUID: 1000 + PGID: 1000 ``` + +The `/data/www` directory and its contents will be chowned to `$PUID:$PGID` and chmodded to `0755` for directories and `0644` for files at container start. diff --git a/rootfs/app/entrypoint.sh b/rootfs/app/entrypoint.sh index e8cc20e..883ef10 100755 --- a/rootfs/app/entrypoint.sh +++ b/rootfs/app/entrypoint.sh @@ -3,12 +3,17 @@ WEBROOT=/data/www PHP=${PHP:-none} USERNAME=${USERNAME:-theuser} +PUID=${PUID:-1000} +GROUPNAME=${GROUPNAME:-thegroup} +PGID=${PGID:-1000} RANDOMPWD=$(tr -dc A-Za-z0-9