Implement https://github.com/twentyhq/twenty/issues/5976 suggestion. It leads to faster boot time since we don't have to install dependencies. It should also solve https://github.com/twentyhq/twenty/issues/4772 as we don't need to run ressource-heavy `npm install` (the mentioned migration step does not seem to exist anymore anyway.
18 lines
549 B
Bash
Executable File
18 lines
549 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Check if the initialization has already been done and that we enabled automatic migration
|
|
if [ "${ENABLE_DB_MIGRATIONS}" = "true" ] && [ ! -f /app/docker-data/db_status ]; then
|
|
echo "Running database setup and migrations..."
|
|
|
|
# Run setup and migration scripts
|
|
NODE_OPTIONS="--max-old-space-size=1500" tsx ./scripts/setup-db.ts
|
|
yarn database:migrate:prod
|
|
|
|
# Mark initialization as done
|
|
echo "Successfuly migrated DB!"
|
|
touch /app/docker-data/db_status
|
|
fi
|
|
|
|
# Continue with the original Docker command
|
|
exec "$@"
|