Files
newznab-tmux/docker/8.5/start-container
T
2026-08-27 19:01:30 +02:00

42 lines
1.2 KiB
Bash

#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
addgroup supervisor > /dev/null 2>&1
usermod -a -G supervisor sail > /dev/null 2>&1
# Run PHP-FPM as `sail` so its uid/gid match files written via the bind mount
# (host user = sail's primary group). Avoids "chmod(): Operation not permitted"
# on storage/logs when files were created by the host user or other processes.
# The FPM unix socket stays owned by www-data so nginx (running as www-data)
# can connect to it.
SAIL_GROUP="$(id -gn sail)"
cat > /etc/php/8.5/fpm/pool.d/zz-sail.conf <<EOF
[www]
user = sail
group = ${SAIL_GROUP}
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
EOF
# Vite is started separately with `make npm-dev`. A hot file left behind by a
# previous dev-server process makes Laravel request assets from a dead port.
unlink /var/www/html/public/hot 2>/dev/null || true
# Set timezone
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord --nodaemon -c /etc/supervisor/supervisord.conf
fi