initial draft from chatgpt
This commit is contained in:
22
docker-entrypoint.sh
Normal file
22
docker-entrypoint.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Prepare storage and symlink
|
||||||
|
ln -sfn /mnt/data/storage /var/www/html/storage
|
||||||
|
ln -sfn /mnt/data/public /var/www/html/public
|
||||||
|
|
||||||
|
# Initialize MariaDB if needed
|
||||||
|
if [ ! -d "/mnt/data/mysql/mysql" ]; then
|
||||||
|
mysqld --initialize-insecure --datadir=/mnt/data/mysql
|
||||||
|
mysqld_safe --datadir=/mnt/data/mysql &
|
||||||
|
until mysqladmin ping; do sleep 1; done
|
||||||
|
mysql -e "CREATE DATABASE ninja;"
|
||||||
|
mysql -e "CREATE USER 'ninja'@'localhost' IDENTIFIED BY 'secret';"
|
||||||
|
mysql -e "GRANT ALL PRIVILEGES ON ninja.* TO 'ninja'@'localhost';"
|
||||||
|
mysqladmin shutdown
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Migrate and serve
|
||||||
|
php artisan migrate --force
|
||||||
|
exec "$@"
|
||||||
|
|
||||||
Reference in New Issue
Block a user