Commit fd7d902c authored by Alexandre Friquet's avatar Alexandre Friquet
Browse files

Initialize app on docker-compose up. #113

parent a6d61cb6
......@@ -13,10 +13,12 @@ services:
- bundle:/usr/local/bundle
- rails_cache:/app/tmp/cache
environment:
- LEADER=true
- RAILS_ENV=${RAILS_ENV:-development}
- HISTFILE=/app/log/.bash_history
- EDITOR=vim
entrypoint: docker/entrypoint_app.sh
command: bundle exec rails s -p 3000 -b 0.0.0.0
ports:
- '3000:3000'
jobs:
......@@ -31,6 +33,7 @@ services:
- RAILS_ENV=${RAILS_ENV:-development}
- HISTFILE=/app/log/.bash_history
- EDITOR=vim
entrypoint: docker/entrypoint_app.sh
command: bundle exec rake jobs:work
depends_on:
- app
......
#!/bin/bash
# Cleanup
rm -f tmp/pids/server.pid
if [ $LEADER ]; then
# Install dependencies
bundle check || bundle install || exit 1
# Cleanup
rm -f tmp/pids/server.pid
# Prepare DB
bundle exec rails db:setup
else
# Wait for it…
until curl --output /dev/null --silent --head --fail "app:3000"; do
sleep 1
done
fi
# Start
bundle exec rails s -b 0.0.0.0 -p 3000
exec "$@"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment