22 lines
510 B
Bash
22 lines
510 B
Bash
|
|
#!/bin/sh
|
||
|
|
set -e
|
||
|
|
|
||
|
|
# Wait for Postgres to be ready
|
||
|
|
echo "Waiting for postgres..."
|
||
|
|
while ! nc -z db 5432; do
|
||
|
|
sleep 1
|
||
|
|
done
|
||
|
|
echo "PostgreSQL started"
|
||
|
|
|
||
|
|
# Create database if it doesn't exist
|
||
|
|
bin/my_first_elixir_vibe_code eval "MyFirstElixirVibeCode.Release.create_db()"
|
||
|
|
|
||
|
|
# Run migrations
|
||
|
|
bin/my_first_elixir_vibe_code eval "MyFirstElixirVibeCode.Release.migrate()"
|
||
|
|
|
||
|
|
# Create admin user if needed
|
||
|
|
bin/my_first_elixir_vibe_code eval "MyFirstElixirVibeCode.Release.seed_admin()"
|
||
|
|
|
||
|
|
# Start the Phoenix server
|
||
|
|
exec "$@"
|