Moved bash code into .sh file

This commit is contained in:
2025-02-07 00:59:59 +01:00
parent 67a4c6763b
commit 9ea12ee458
2 changed files with 27 additions and 13 deletions

24
docker-start.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# Start Redis in the background
redis-server --daemonize yes
# Start MySQL
mysqld --user=mysql --datadir=/var/lib/mysql &
# Wait for MySQL to be ready
while ! mysqladmin ping -h localhost --silent; do
echo "Waiting for MySQL to be ready..."
sleep 2
done
echo "MySQL is ready!"
# Run database migrations
npx mikro-orm migration:up
# Start the Node.js application in a tmux session
tmux new-session -d -s nodeapp "node dist/server.js"
echo "App is running in tmux session. Attach with: tmux attach-session -t nodeapp"
# Keep container running
tail -f /dev/null