-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·56 lines (46 loc) · 1.15 KB
/
entrypoint.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Run rails by default if sidekiq is specified
if [ -z "$RUN_RAILS" ] && [ -z "$RUN_SIDEKIQ" ]; then
RUN_RAILS=true
echo "⚠️ RUN_RAILS and RUN_SIDEKIQ are not set, defaulting to RUN_RAILS=true"
fi
if [ "$QUEUE_ADAPTER" != "sidekiq" ]; then
RUN_SIDEKIQ=false
echo "⚠️ Sidekiq is disabled because QUEUE_ADAPTER is not set to sidekiq"
fi
# ensure booleans
if [ "$RUN_RAILS" == "true" ] || [ "$RUN_RAILS" == "1" ]; then
RUN_RAILS=true
else
RUN_RAILS=false
fi
if [ "$RUN_SIDEKIQ" == "true" ] || [ "$RUN_SIDEKIQ" == "1" ]; then
RUN_SIDEKIQ=true
else
RUN_SIDEKIQ=false
fi
if [ "$RUN_RAILS" == "true" ]; then
echo "✅ Running Rails"
fi
if [ "$RUN_SIDEKIQ" == "true" ]; then
echo "✅ Running Sidekiq"
fi
export RUN_RAILS
export RUN_SIDEKIQ
# Check all the gems are installed or fails.
bundle check
if [ $? -ne 0 ]; then
echo "❌ Gems in Gemfile are not installed, aborting..."
exit 1
else
echo "✅ Gems in Gemfile are installed"
fi
# Check no migrations are pending migrations
if [ -z "$SKIP_MIGRATIONS" ]; then
bundle exec rails db:migrate
else
echo "⚠️ Skipping migrations"
fi
echo "✅ Migrations are all up"
echo "🚀 $@"
exec "$@"