feat(deploy): add docker app+mysql stack for coolify

This commit is contained in:
Dwindi Ramadhana
2026-02-04 21:05:59 +07:00
parent 0c45435db9
commit 0d5e1a4aa1
6 changed files with 182 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public
<Directory /var/www/html/public>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

27
app/docker/entrypoint.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env sh
set -eu
cd /var/www/html
php artisan config:clear >/dev/null 2>&1 || true
if [ "${DB_CONNECTION:-}" = "mysql" ] && [ "${WAIT_FOR_DB:-true}" = "true" ]; then
echo "Waiting for MySQL at ${DB_HOST:-mysql}:${DB_PORT:-3306}..."
i=0
while [ "$i" -lt 60 ]; do
if php -r 'try { new PDO("mysql:host=".getenv("DB_HOST").";port=".getenv("DB_PORT").";dbname=".getenv("DB_DATABASE"), getenv("DB_USERNAME"), getenv("DB_PASSWORD"), [PDO::ATTR_TIMEOUT => 3]); exit(0);} catch (Throwable $e) { exit(1);}'; then
echo "MySQL is reachable."
break
fi
i=$((i + 1))
sleep 2
done
fi
if [ "${RUN_MIGRATIONS:-true}" = "true" ]; then
php artisan migrate --force
fi
php artisan storage:link >/dev/null 2>&1 || true
exec "$@"