-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.sh
40 lines (29 loc) · 1.03 KB
/
entrypoint.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
#!/bin/bash
cd /app/backend
# Set up ChromaDB model persistence
echo "[entrypoint.sh] Setting up ChromaDB model persistence..."
CACHE_DIR="/root/.cache/chroma/onnx_models"
PERSISTENT_DIR="/app/data/.chromadb/models"
# Create persistent directory if it doesn't exist
mkdir -p "$PERSISTENT_DIR"
# Remove existing cache directory or symlink if it exists
rm -rf "$CACHE_DIR"
# Create parent directory for cache
mkdir -p "$(dirname "$CACHE_DIR")"
# Create symlink
ln -s "$PERSISTENT_DIR" "$CACHE_DIR"
# Wait for database to be ready
echo "[entrypoint.sh] Waiting for database..."
poetry run python app/wait_for_db.py
# Run migrations
echo "[entrypoint.sh] Running database migrations..."
poetry run alembic upgrade head
# Run the seeding script
echo "[entrypoint.sh] Running initial data script..."
poetry run python app/initial_data.py
# Change back to root directory before executing start.sh
echo "[entrypoint.sh] Changing back to root directory..."
cd /app
# Start the application
echo "[entrypoint.sh] Executing start.sh with args: $@"
exec "$@"