This commit is contained in:
parent
4e9ca79504
commit
7a8422f208
@ -10,6 +10,8 @@ VOLUME [ "/data/www", "/ssh" ]
|
|||||||
|
|
||||||
ENV \
|
ENV \
|
||||||
USERNAME=theuser \
|
USERNAME=theuser \
|
||||||
PHP=none
|
PHP=none \
|
||||||
|
PUID=1000 \
|
||||||
|
PGID=1000
|
||||||
|
|
||||||
ENTRYPOINT [ "/sbin/tini", "/app/entrypoint.sh" ]
|
ENTRYPOINT [ "/sbin/tini", "/app/entrypoint.sh" ]
|
||||||
|
@ -20,4 +20,8 @@ services:
|
|||||||
- ./ssh:/ssh # add authorized_keys file here
|
- ./ssh:/ssh # add authorized_keys file here
|
||||||
environment:
|
environment:
|
||||||
PHP: php84 # none (default), php82, php83, php84
|
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
|
WEBROOT=/data/www
|
||||||
PHP=${PHP:-none}
|
PHP=${PHP:-none}
|
||||||
USERNAME=${USERNAME:-theuser}
|
USERNAME=${USERNAME:-theuser}
|
||||||
|
PUID=${PUID:-1000}
|
||||||
|
GROUPNAME=${GROUPNAME:-thegroup}
|
||||||
|
PGID=${PGID:-1000}
|
||||||
RANDOMPWD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13)
|
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}"
|
printf '%s\n%s' "${RANDOMPWD}" "${RANDOMPWD}" | passwd "${USERNAME}"
|
||||||
echo "password for the user \"${USERNAME}\" is: ${RANDOMPWD}"
|
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 d -exec chmod 0755 {} \;
|
||||||
find "${WEBROOT}" -type f -exec chmod 0644 {} \;
|
find "${WEBROOT}" -type f -exec chmod 0644 {} \;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user