-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
Β·58 lines (45 loc) Β· 1.46 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
Β·58 lines (45 loc) Β· 1.46 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
#!/bin/bash
# ETI RAG System Docker Entrypoint
set -e
echo "π Starting ETI RAG System..."
# Check if OPENAI_API_KEY is set
if [ -z "$OPENAI_API_KEY" ]; then
echo "β Error: OPENAI_API_KEY environment variable is required"
exit 1
fi
# Check if indexes exist, if not run ingestion
if [ ! -f "/var/data/index/metadata.json" ]; then
echo "π No indexes found. Running initial ingestion..."
# Use the brief-specified PDF path
HR_MANUAL="/app/data/HR_Manual.pdf"
if [ ! -f "$HR_MANUAL" ]; then
echo "β Error: PDF not found at $HR_MANUAL"
exit 1
fi
echo "π Processing: $HR_MANUAL"
python /app/scripts/ingest.py --pdf "$HR_MANUAL" --output-dir /var/data/index
if [ $? -eq 0 ]; then
echo "β
Ingestion completed successfully"
else
echo "β Ingestion failed"
exit 1
fi
else
echo "β
Indexes found, skipping ingestion"
fi
# Start the FastAPI service in the background
echo "π Starting FastAPI service..."
cd /app
python -m uvicorn app.main:app --host 0.0.0.0 --port 8080 &
# Wait a bit for FastAPI to start
sleep 5
# Check if FastAPI is running
if curl -f http://localhost:8080/healthz > /dev/null 2>&1; then
echo "β
FastAPI service is running"
else
echo "β FastAPI service failed to start"
exit 1
fi
# Start Streamlit UI
echo "π¨ Starting Streamlit UI..."
streamlit run /app/app/ui.py --server.port 8501 --server.address 0.0.0.0 --server.headless true