summaryrefslogtreecommitdiff
path: root/bin/docker-entrypoint
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2025-08-24 20:29:54 +0200
committerMarius Peter <marius.peter@tutanota.com>2025-08-24 20:29:54 +0200
commit52b044d6a4278c229992404ad5801769c2d13363 (patch)
treeb30b34da58f26117c035391d09366b190350b1e3 /bin/docker-entrypoint
First commit.
Vive le Castel Peter !
Diffstat (limited to 'bin/docker-entrypoint')
-rwxr-xr-xbin/docker-entrypoint14
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint
new file mode 100755
index 0000000..57567d6
--- /dev/null
+++ b/bin/docker-entrypoint
@@ -0,0 +1,14 @@
+#!/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 [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
+ ./bin/rails db:prepare
+fi
+
+exec "${@}"
Copyright 2019--2025 Marius PETER