summaryrefslogtreecommitdiff
path: root/bin/docker-entrypoint
diff options
context:
space:
mode:
Diffstat (limited to 'bin/docker-entrypoint')
-rwxr-xr-xbin/docker-entrypoint13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint
new file mode 100755
index 0000000..840d093
--- /dev/null
+++ b/bin/docker-entrypoint
@@ -0,0 +1,13 @@
+#!/bin/bash -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
+
+# If running the rails server then create or migrate existing database
+if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
+ ./bin/rails db:prepare
+fi
+
+exec "${@}"
Copyright 2019--2024 Marius PETER