Skip to content

Instantly share code, notes, and snippets.

@steeve
Last active December 23, 2015 05:29
Show Gist options
  • Save steeve/6587251 to your computer and use it in GitHub Desktop.
Save steeve/6587251 to your computer and use it in GitHub Desktop.
ADD start.sh /
RUN chmod +x /start.sh
ENTRYPOINT ["/start.sh"]
#!/bin/bash
USER=$1
PASSWORD=$2
ROOT_PASSWORD=$3
# Make sure the DB exists
if [ ! "$(ls -A /var/lib/mysql)" ]; then
echo "Configuring database..."
mysql_install_db
mysqld_safe &
sleep 5
mysql -uroot -e "CREATE DATABASE IF NOT EXISTS mydb;"
mysql -uroot -e "GRANT ALL PRIVILEGES ON vbulletin.* TO '$USER'@'localhost' IDENTIFIED BY '$PASSWORD';"
mysqladmin -u root password "$ROOT_PASSWORD"
kill `cat /var/run/mysqld/mysqld.pid`
fi
# Run all the daemons
supervisord -n -c /etc/supervisord.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment