-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-entrypoint.backend.sh
More file actions
43 lines (33 loc) Β· 1.06 KB
/
docker-entrypoint.backend.sh
File metadata and controls
43 lines (33 loc) Β· 1.06 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
#!/bin/bash
# ETI RAG System Backend Docker Entrypoint
set -e
echo "π Starting ETI RAG Backend..."
# 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/ETI_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
echo "π Starting FastAPI service..."
cd /app
python -m uvicorn app.main:app --host 0.0.0.0 --port 8080