fix: use list-form command with literal block to avoid sh syntax error

YAML folded scalar (>) preserves newlines on more-indented continuation
lines, so the shell received && on its own line which is invalid in
dash. Switched to the list form [/bin/sh, -c, |script|] so Docker
passes the script verbatim to sh -c without double-wrapping.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-05-14 12:20:08 -04:00
parent de051fb2e7
commit 3d94c4eb25

View File

@@ -27,7 +27,7 @@ services:
networks: networks:
- rag_net - rag_net
# No healthcheck — qdrant image does not ship curl/wget. # No healthcheck — qdrant image does not ship curl/wget.
# Dependent services use a wait-loop via our own image which has curl. # Dependent services wait via a loop in our own image (which has curl).
rag-api: rag-api:
build: . build: .
@@ -35,11 +35,15 @@ services:
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- qdrant - qdrant
# Wait for Qdrant to accept HTTP before starting uvicorn command:
command: > - /bin/sh
sh -c "until curl -sf http://qdrant:6333/ > /dev/null 2>&1; - -c
do echo 'waiting for qdrant...'; sleep 3; done - |
&& uvicorn api.main:app --host 0.0.0.0 --port 8000 --workers 2" until curl -sf http://qdrant:6333/ > /dev/null 2>&1; do
echo 'waiting for qdrant...'
sleep 3
done
exec uvicorn api.main:app --host 0.0.0.0 --port 8000 --workers 2
ports: ports:
- "8000:8000" - "8000:8000"
environment: environment:
@@ -72,11 +76,15 @@ services:
build: . build: .
container_name: odoo18-indexer container_name: odoo18-indexer
profiles: ["indexer"] profiles: ["indexer"]
# Wait for Qdrant before indexing command:
command: > - /bin/sh
sh -c "until curl -sf http://qdrant:6333/ > /dev/null 2>&1; - -c
do echo 'waiting for qdrant...'; sleep 3; done - |
&& python /app/indexer/indexer.py" until curl -sf http://qdrant:6333/ > /dev/null 2>&1; do
echo 'waiting for qdrant...'
sleep 3
done
exec python /app/indexer/indexer.py
depends_on: depends_on:
- qdrant - qdrant
volumes: volumes: