Add Docker Compose production stack (php-apache, mariadb, node/pm2)

This commit is contained in:
Thanakorn
2026-08-17 13:44:14 +07:00
parent 234814a23c
commit 4c4522169c
9 changed files with 192 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#!/bin/sh
set -e
APP_DIR=/var/www/html/wms-app
CONFIG=$APP_DIR/app/config.php
# Generate app/config.php from template on first run only.
# Restrict envsubst to known placeholders so it never touches the app's own
# $variable syntax (envsubst blanks out any $NAME it doesn't recognize).
if [ ! -f "$CONFIG" ]; then
echo "[entrypoint] generating app/config.php"
envsubst '${DB_ROOT_PASSWORD} ${PUBLIC_HOST} ${EMIT_SECRET} ${SMTP_USERNAME} ${SMTP_PASSWORD}' \
< /usr/local/etc/wms/config.php.template > "$CONFIG"
fi
mkdir -p "$APP_DIR/app/uploads"
chown -R www-data:www-data "$APP_DIR/app/uploads"
echo "[entrypoint] waiting for database at db:3306"
until mysqladmin ping -h db -u root -p"$DB_ROOT_PASSWORD" --silent 2>/dev/null; do
sleep 2
done
echo "[entrypoint] running setup.php (idempotent schema sync)"
php "$APP_DIR/setup.php" || true
exec "$@"