Files
api/bin/docker-entrypoint.baclight
Jason Jordan 1c80e642f5
CI / scan_ruby (push) Failing after 37s
CI / lint (push) Failing after 39s
Production Build Working
2026-09-16 12:41:44 -04:00

33 lines
1.0 KiB
Bash

#!/bin/bash -e
set -e
# Enable jemalloc for reduced memory usage and latency.
if [ -z "${LD_PRELOAD+x}" ] && [ -f /usr/lib/*/libjemalloc.so.2 ]; then
export LD_PRELOAD="$(echo /usr/lib/*/libjemalloc.so.2)"
fi
# This prevents "A server is already running" errors if a previous container crashed.
if [ -f tmp/pids/server.pid ]; then
rm -f tmp/pids/server.pid
fi
rm -rf /usr/local/bundle/cache/*.gem
echo "bundle install..."
bundle check || bundle install --jobs 4
# NOTE: Enable this as you need to get migrations working in your deployed
# (i.e. Production) environments. Match the condition check to what you have in
# the Dockerfile CMD. I use puma in the production.Dockerfile as that's the
# recommended option by the Puma team (https://github.com/puma/puma#rails), but
# the default Rails Dockerfile uses `./bin/rails server`
echo "starting puma server..."
# If running the rails server then create or migrate existing database
if [ "${1}" == "bundle" ] && [ "${2}" == "exec" ] && [ "${3}" == "puma" ]; then
./bin/rails db:migrate
fi
exec "${@}"