-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
70 lines (61 loc) · 1.34 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# #!/bin/bash
#
# until pg_isready -h db -p 5432; do
# echo "Waiting for postgres to be ready..."
# sleep 2
# done
# if [ ! -f "./app/migration_applied" ]; then
# npm run generate
# bun run migrate
# bun run start
# touch "./app/migration_applied"
# fi
# exit
# echo "postgres is ready"
#
# # Start Next.js app
# echo "Starting Next.js app..."
# app_cmd="bun start"
# $app_cmd &
# app_pid=$!
#
#
# # Wait for any process to exit
# trap "exit" INT TERM
# wait $postgres_pid $app_pid
# exit $?
#!/bin/sh
# wait_for_postgres() {
# # Increased wait time and added error handling
# until pg_isready -h db -p 5432 > /dev/null 2>&1; do
# echo "Waiting for PostgreSQL to be ready..."
# sleep 5
# done
# if [ $? -eq 0 ]; then
# echo "PostgreSQL is ready."
# else
# echo "Error: Could not connect to PostgreSQL."
# exit 1
# fi
# }
#
# # Wait for PostgreSQL to be ready
# wait_for_postgres
#
# # Test connection with psql (optional)
# psql -h db -U $POSTGRES_USER -d $POSTGRES_DB
#
# # Run migrations and start the app if migrations have not been applied
# if [ ! -f "./app/migration_applied" ]; then
# npm run generate
# bun run migrate
# bun run start
# touch "./app/migration_applied"
# fi
echo "Starting Next.js app..."
# Start Next.js app
RUN bun install
RUN bun generate
RUN bun migrate
RUN bun next build
bun start