-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.dev.sh
More file actions
38 lines (30 loc) · 1.07 KB
/
docker-entrypoint.dev.sh
File metadata and controls
38 lines (30 loc) · 1.07 KB
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
#!/bin/bash
set -e
echo "=== Docker Entrypoint Starting ==="
echo "Running as: $(id)"
# Ensure directories exist and fix permissions (we start as root)
mkdir -p /app/data /app/logs
chown -R appuser:appuser /app/data /app/logs /data
echo "Permissions fixed for appuser (1000:1000)"
# Switch to appuser for all processes
echo "Switching to appuser and starting services..."
exec gosu appuser bash -c '
echo "Now running as: $(id)"
# Start backend with hot reload
cd /app/backend
echo "Starting backend on port 8080..."
uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload &
BACKEND_PID=$!
# Start frontend dev server
cd /app/frontend
echo "Starting frontend on port 5173..."
npm run dev -- --host 0.0.0.0 --port 5173 &
FRONTEND_PID=$!
echo "Services started - Backend: $BACKEND_PID, Frontend: $FRONTEND_PID"
# Wait for any process to exit
wait -n
EXIT_CODE=$?
echo "Process exited with code $EXIT_CODE, shutting down..."
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null || true
exit $EXIT_CODE
'