Spaces:
Sleeping
Sleeping
Commit ·
a7fc579
1
Parent(s): 44bc4a5
try 8
Browse files- Dockerfile +0 -3
- app/settings.py +2 -2
- start.sh +10 -35
Dockerfile
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
# syntax=docker/dockerfile:1
|
| 2 |
FROM python:3.12.10
|
| 3 |
|
| 4 |
RUN useradd -m -u 1000 user
|
|
@@ -19,8 +18,6 @@ RUN wget https://github.com/qdrant/qdrant/releases/download/v1.11.5/qdrant-x86_6
|
|
| 19 |
|
| 20 |
COPY --chown=user . /app
|
| 21 |
|
| 22 |
-
EXPOSE 7860
|
| 23 |
-
|
| 24 |
RUN chmod +x start.sh
|
| 25 |
|
| 26 |
CMD ["./start.sh"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.12.10
|
| 2 |
|
| 3 |
RUN useradd -m -u 1000 user
|
|
|
|
| 18 |
|
| 19 |
COPY --chown=user . /app
|
| 20 |
|
|
|
|
|
|
|
| 21 |
RUN chmod +x start.sh
|
| 22 |
|
| 23 |
CMD ["./start.sh"]
|
app/settings.py
CHANGED
|
@@ -65,8 +65,8 @@ class TextSplitterSettings(BaseModel):
|
|
| 65 |
|
| 66 |
class APISettings(BaseModel):
|
| 67 |
app: str = "app.api.api:api"
|
| 68 |
-
host: str = "
|
| 69 |
-
port: int =
|
| 70 |
reload: bool = True # The server will reload on system changes
|
| 71 |
|
| 72 |
|
|
|
|
| 65 |
|
| 66 |
class APISettings(BaseModel):
|
| 67 |
app: str = "app.api.api:api"
|
| 68 |
+
host: str = "127.0.0.1"
|
| 69 |
+
port: int = 5050
|
| 70 |
reload: bool = True # The server will reload on system changes
|
| 71 |
|
| 72 |
|
start.sh
CHANGED
|
@@ -1,45 +1,20 @@
|
|
| 1 |
#!/usr/bin/env sh
|
| 2 |
-
|
| 3 |
echo "step 0 is ready"
|
| 4 |
-
#
|
| 5 |
-
export $(grep -v '^#' /app/.env | xargs)
|
| 6 |
-
echo "Loaded environment variables from .env"
|
| 7 |
-
|
| 8 |
-
# Run initializer
|
| 9 |
python -m app.initializer
|
| 10 |
echo "step 1 is ready"
|
| 11 |
|
| 12 |
# Start Qdrant in the background with fresh storage snapshot directory
|
| 13 |
-
rm -rf ./database/*
|
| 14 |
qdrant --config-path config.yaml &
|
| 15 |
echo "step 2 is ready"
|
| 16 |
-
# Wait for Qdrant
|
| 17 |
-
|
| 18 |
-
if curl -s http://localhost:6333/healthz | grep -q "ok"; then
|
| 19 |
-
echo "Qdrant is ready!"
|
| 20 |
-
break
|
| 21 |
-
fi
|
| 22 |
-
echo "Waiting for Qdrant..."
|
| 23 |
-
sleep 1
|
| 24 |
-
done
|
| 25 |
echo "step 3 is ready"
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
python -m app.
|
| 32 |
-
echo "step 5 is ready"
|
| 33 |
-
|
| 34 |
-
# Wait for uvicorn
|
| 35 |
-
for i in {1..10}; do
|
| 36 |
-
if curl -s http://localhost:7860/health | grep -q "ok"; then
|
| 37 |
-
echo "Uvicorn is ready!"
|
| 38 |
-
break
|
| 39 |
-
fi
|
| 40 |
-
echo "Waiting for uvicorn..."
|
| 41 |
-
sleep 1
|
| 42 |
-
done
|
| 43 |
-
|
| 44 |
-
# Keep container running
|
| 45 |
-
tail -f /dev/null
|
|
|
|
| 1 |
#!/usr/bin/env sh
|
|
|
|
| 2 |
echo "step 0 is ready"
|
| 3 |
+
# Run initializer and wait for it to complete
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
python -m app.initializer
|
| 5 |
echo "step 1 is ready"
|
| 6 |
|
| 7 |
# Start Qdrant in the background with fresh storage snapshot directory
|
| 8 |
+
rm -rf ./database/* # Clear old data
|
| 9 |
qdrant --config-path config.yaml &
|
| 10 |
echo "step 2 is ready"
|
| 11 |
+
# Wait longer for Qdrant to spin up
|
| 12 |
+
sleep 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
echo "step 3 is ready"
|
| 14 |
|
| 15 |
+
python -m app.automigration
|
| 16 |
+
echo "step 4 is ready"
|
| 17 |
+
# Start the main application
|
| 18 |
+
uvicorn app.api.api:api --host 0.0.0.0 --port 7860
|
| 19 |
+
#python -m app.main
|
| 20 |
+
echo "step 5 is ready"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|