Moved bash code into .sh file
This commit is contained in:
24
docker-start.sh
Normal file
24
docker-start.sh
Normal 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
|
Reference in New Issue
Block a user