Repository navigation
Expand file tree
/
Copy pathdocker-entrypoint-dev.sh
More file actions
65 lines (54 loc) · 1.8 KB
/
Copy pathdocker-entrypoint-dev.sh
File metadata and controls
65 lines (54 loc) · 1.8 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
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
#!/bin/bash
# =============================================================================
# DEPRECATED: This entrypoint script is deprecated.
#
# Please use the new Docker Compose-based development environment instead:
# make dev - Start minimal development environment
# make dev-full - Start full stack with Gateway and Plugins
#
# See dev/README.md for full documentation.
# =============================================================================
# Create .env from example if it doesn't exist
if [ ! -f /app/.env ]; then
cp /app/.env.example /app/.env
echo ".env file created from .env.example"
fi
# Start frontend dev server in background (skip if SKIP_FRONTEND_DEV is set)
# When using pre-built frontend, the Go binary serves it via embed
if [ "${SKIP_FRONTEND_DEV}" != "true" ]; then
echo "Starting frontend dev server..."
cd /app/ui/admin-frontend
npm start &
else
echo "Skipping frontend dev server (using embedded build)"
fi
# Build and start backend
echo "Building and starting backend..."
cd /app
# Build edition based on BUILD_EDITION env var (default: enterprise)
BUILD_EDITION="${BUILD_EDITION:-enterprise}"
echo "Performing Go build (${BUILD_EDITION})..."
mkdir -p bin
if [ "$BUILD_EDITION" = "community" ] || [ "$BUILD_EDITION" = "ce" ]; then
CGO_ENABLED=1 go build -o bin/midsommar .
else
CGO_ENABLED=1 go build -tags enterprise -o bin/midsommar-ent .
fi
if [ $? -ne 0 ]; then
echo "Go build failed!"
exit 1
fi
# Start the server
echo "Starting server..."
if [ "$BUILD_EDITION" = "community" ] || [ "$BUILD_EDITION" = "ce" ]; then
./bin/midsommar &
else
./bin/midsommar-ent &
fi
SERVER_PID=$!
# Wait for any process to exit
wait -n
# Kill remaining processes
kill $SERVER_PID 2>/dev/null
# Exit with the same code as the failed process
exit $?