1
0
forked from noxious/server
noxious_server/docker-start.sh
2025-02-07 01:19:44 +01:00

24 lines
577 B
Bash

#!/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 src/server.js"
echo "App is running in tmux session. Attach with: tmux attach-session -t nodeapp"
# Keep container running
tail -f /dev/null