Spaces:
Running
Running
Gemini
commited on
Commit
·
293b6bd
1
Parent(s):
e729ce4
fix: use start.sh script to start the application
Browse files- Dockerfile +4 -1
- start.sh +26 -0
Dockerfile
CHANGED
@@ -58,6 +58,9 @@ COPY lpm_kernel/ /app/lpm_kernel/
|
|
58 |
RUN echo "--- Listing /app/docker directory ---" && ls -la /app/docker
|
59 |
RUN echo "--- Listing /app/lpm_kernel directory ---" && ls -la /app/lpm_kernel
|
60 |
|
|
|
|
|
|
|
61 |
# Check module import
|
62 |
RUN python -c "import lpm_kernel; print('Module import check passed')"
|
63 |
|
@@ -75,4 +78,4 @@ ENV PYTHONUNBUFFERED=1 \
|
|
75 |
EXPOSE 8002 8080
|
76 |
|
77 |
# Set the startup command
|
78 |
-
CMD ["
|
|
|
58 |
RUN echo "--- Listing /app/docker directory ---" && ls -la /app/docker
|
59 |
RUN echo "--- Listing /app/lpm_kernel directory ---" && ls -la /app/lpm_kernel
|
60 |
|
61 |
+
# Copy the start script
|
62 |
+
COPY start.sh /app/
|
63 |
+
|
64 |
# Check module import
|
65 |
RUN python -c "import lpm_kernel; print('Module import check passed')"
|
66 |
|
|
|
78 |
EXPOSE 8002 8080
|
79 |
|
80 |
# Set the startup command
|
81 |
+
CMD ["./start.sh"]
|
start.sh
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
echo "--- Checking SQLite database... ---"
|
4 |
+
if [ ! -s /app/data/sqlite/lpm.db ]; then
|
5 |
+
echo "SQLite database not found or empty, initializing..."
|
6 |
+
mkdir -p /app/data/sqlite
|
7 |
+
sqlite3 /app/data/sqlite/lpm.db ".read /app/docker/sqlite/init.sql"
|
8 |
+
echo "SQLite database initialized successfully"
|
9 |
+
echo "Tables created:"
|
10 |
+
sqlite3 /app/data/sqlite/lpm.db ".tables"
|
11 |
+
else
|
12 |
+
echo "SQLite database already exists, skipping initialization"
|
13 |
+
fi
|
14 |
+
|
15 |
+
echo "--- Checking ChromaDB... ---"
|
16 |
+
if [ ! -d /app/data/chroma_db/documents ] || [ ! -d /app/data/chroma_db/document_chunks ]; then
|
17 |
+
echo "ChromaDB collections not found, initializing..."
|
18 |
+
python /app/docker/app/init_chroma.py
|
19 |
+
echo "ChromaDB initialized successfully"
|
20 |
+
else
|
21 |
+
echo "ChromaDB already exists, skipping initialization"
|
22 |
+
fi
|
23 |
+
|
24 |
+
echo "--- Starting application... ---"
|
25 |
+
cd /app
|
26 |
+
python -m flask run --host=0.0.0.0 --port=${LOCAL_APP_PORT:-8002}
|