added dockerfile for local run

This commit is contained in:
Chris Zhu
2025-02-18 13:17:35 -08:00
parent fc8966410a
commit bbaf6ef784
3 changed files with 17 additions and 3 deletions

View File

@@ -6,9 +6,9 @@ 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 or bin/dev then create or migrate existing database
# 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" ]; then
if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ] || [ "${1}" == "./bin/dev" ] || [ "${1}" == "./bin/run" ]; then
echo "Preparing database..."
./bin/rails db:create
./bin/rails db:prepare

13
bin/run Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env sh
if ! gem list foreman -i --silent; then
echo "Installing foreman..."
gem install foreman
fi
# Let the debug gem allow remote connections,
# but avoid loading until `debugger` is called
export RUBY_DEBUG_OPEN="true"
export RUBY_DEBUG_LAZY="true"
exec foreman start -f Procfile "$@"