-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·38 lines (29 loc) · 934 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·38 lines (29 loc) · 934 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
#!/usr/bin/env bash
#
# This script waits 15 seconds for connection with the database,
# then it will reset the database if RESET_DATABASE is "true"
# and after that will start the we server
set -o errexit
set -o pipefail
set -o nounset
TIMEOUT=120
# Source bashrc to config correct node and yarn versions
source ~/.bashrc
# Remove a potentially pre-existing server.pid for Rails.
rm -f /code/tmp/pids/server.pid
# Install any missing packages - very useful for development without rebuilding the image
bundle install
./wait_for_connection.sh "${DBHOST}" "${DBPORT}" "${TIMEOUT}"
if [ "${RESET_DATABASE:-}" = "true" ]; then
echo "Resetting database"
bundle exec rake db:reset
fi
# Build the static web assets
if [ "${PRECOMPILE_ASSETS:-}" = "true" ]; then
echo "Precompiling assets"
echo "Vite info"
bin/vite info
bundle exec rails assets:precompile
fi
echo "Starting service"
exec bundle exec rails s -b 0.0.0.0