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
- 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 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
97 |
else
|
98 |
-
echo "
|
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..."
|