Skip to content

Commit

Permalink
Align docker-entrypoint to Rails 8 conventions
Browse files Browse the repository at this point in the history
Because we're running `bin/thrust` before `bin/rails server`, we have to
update the conditional for `db:prepare` to take this into account.

Also add the `jemalloc` bit which should significantly improve memory
usage.
  • Loading branch information
tvararu committed Dec 12, 2024
1 parent 753bbba commit aace150
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin/docker-entrypoint
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash -e

# Enable jemalloc for reduced memory usage and latency.
if [ -z "${LD_PRELOAD+x}" ]; then
LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
export LD_PRELOAD
fi

# If running the rails server then create or migrate existing database
if [ "${*}" == "./bin/rails server" ]; then
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
./bin/rails db:prepare:ignore_concurrent_migration_exceptions
fi

Expand Down

0 comments on commit aace150

Please sign in to comment.