mirror of
https://github.com/czhu12/canine.git
synced 2025-12-30 15:49:54 -06:00
18 lines
609 B
Bash
Executable File
18 lines
609 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
# Enable jemalloc for reduced memory usage and latency.
|
|
echo "Executing pre-entrypoint script..."
|
|
if [ -z "${LD_PRELOAD+x}" ] && [ -f /usr/lib/*/libjemalloc.so.2 ]; then
|
|
export LD_PRELOAD="$(echo /usr/lib/*/libjemalloc.so.2)"
|
|
fi
|
|
|
|
# If running the rails server, bin/dev, or bin/run then create or migrate existing database
|
|
echo "Checking if database needs to be prepared..."
|
|
if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ] || [ "${1}" == "./bin/dev" ] || [ "${1}" == "./bin/run" ]; then
|
|
echo "Preparing database..."
|
|
./bin/rails db:create
|
|
./bin/rails db:prepare
|
|
fi
|
|
|
|
exec "${@}"
|