This commit is contained in:
parent
4e9ca79504
commit
7a8422f208
@ -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" ]
|
||||
|
@ -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.
|
||||
|
@ -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 </dev/urandom | head -c 13)
|
||||
adduser -DH -h "${WEBROOT}" -G "nginx" -u "1000" "${USERNAME}"
|
||||
addgroup -g "${PGID}" "${GROUPNAME}"
|
||||
addgroup nginx "${GROUPNAME}"
|
||||
adduser -DH -h "${WEBROOT}" -G "${GROUPNAME}" -u "${PUID}" "${USERNAME}"
|
||||
printf '%s\n%s' "${RANDOMPWD}" "${RANDOMPWD}" | passwd "${USERNAME}"
|
||||
echo "password for the user \"${USERNAME}\" is: ${RANDOMPWD}"
|
||||
|
||||
chown "${USERNAME}:nginx" "${WEBROOT}" -R
|
||||
chown "${PUID}:${GROUPNAME}" "${WEBROOT}" -R
|
||||
find "${WEBROOT}" -type d -exec chmod 0755 {} \;
|
||||
find "${WEBROOT}" -type f -exec chmod 0644 {} \;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user