forked from gambe-ro/lobsters
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·42 lines (33 loc) · 945 Bytes
/
docker-entrypoint.sh
File metadata and controls
executable file
·42 lines (33 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
# From a MIT-licensed script by guillaumebriday
until bundle exec rake db:version; do
>&2 echo "Mysql is unavailable - sleeping"
sleep 1
done
# Provision Database.
db_version=$(bundle exec rake db:version | grep 'Current version:')
if [ "$db_version" = "Current version: 0" ]; then
bundle exec rake db:schema:load
bundle exec rake db:migrate
bundle exec rake db:seed
else
bundle exec rake tags:load_from_yaml
bundle exec rake db:migrate
fi
# Run ThinkingSphinx rake tasks to configure Sphinx
bundle exec rake ts:index
bundle exec rake ts:start
if [ "$SECRET_KEY_BASE" = "" ]; then
echo "SECRET_KEY_BASE not set, quitting!"
exit 2
fi
# Rails leaves the PID file behind when the container is shut down
rm -fv tmp/pids/server.pid
if [ "$RAILS_ENV" = "" ]; then
echo "RAILS_ENV not set, quitting!"
exit 1
fi
# Precompile assets
bundle exec rake assets:precompile
# Launch!
unicorn --env $RAILS_ENV