Severian commited on
Commit
a311353
·
1 Parent(s): c400468

fix: add Python dependencies installation

Browse files

- Add pip install before running Flask migrations
- Fix openai module not found error
- Improve error handling for database initialization
- Add proper working directory management

Files changed (1) hide show
  1. docker/entrypoint.sh +15 -9
docker/entrypoint.sh CHANGED
@@ -87,18 +87,24 @@ check_redis || {
87
  exit 1
88
  }
89
 
90
- # Install Python dependencies
91
- cd /app/api
92
- echo "Installing Python dependencies..."
93
- if [ -f "requirements.txt" ]; then
94
- pip install --no-cache-dir -r requirements.txt
95
- elif [ -f "../requirements.txt" ]; then
96
- pip install --no-cache-dir -r ../requirements.txt
 
 
 
 
97
  else
98
- echo "Warning: requirements.txt not found in /app/api or /app"
99
- # Continue anyway as dependencies might be pre-installed in the image
100
  fi
101
 
 
 
 
102
  # Initialize database if needed
103
  if [ ! -f ".db_initialized" ]; then
104
  echo "Running database migrations..."
 
87
  exit 1
88
  }
89
 
90
+ # Install Python dependencies if not in pre-built image
91
+ if [ "${INSTALL_DEPENDENCIES}" = "true" ]; then
92
+ cd /app/api
93
+ echo "Installing Python dependencies..."
94
+ if [ -f "requirements.txt" ]; then
95
+ pip install --no-cache-dir -r requirements.txt
96
+ elif [ -f "../requirements.txt" ]; then
97
+ pip install --no-cache-dir -r ../requirements.txt
98
+ else
99
+ echo "Using pre-installed dependencies from Docker image"
100
+ fi
101
  else
102
+ echo "Using pre-installed dependencies from Docker image"
 
103
  fi
104
 
105
+ # Ensure we're in the correct directory for database operations
106
+ cd /app/api
107
+
108
  # Initialize database if needed
109
  if [ ! -f ".db_initialized" ]; then
110
  echo "Running database migrations..."