fix: bust Docker cache + make init_db non-fatal for Railway

- ARG CACHEBUST=2 forces pip install to re-run (picks up slimmed requirements)
- init_db failure no longer kills the app — logs warning instead

https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
This commit is contained in:
Claude 2026-04-26 01:00:33 +00:00
parent 6b91c96bff
commit ff83d28eba
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

View File

@ -11,7 +11,7 @@ RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH" ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt ./ COPY requirements.txt ./
ARG CACHEBUST=2
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \ RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
&& pip install --no-cache-dir -r requirements.txt && pip install --no-cache-dir -r requirements.txt

View File

@ -89,7 +89,10 @@ async def lifespan(app: FastAPI):
except Exception as e: except Exception as e:
print(f" DLQ: init failed ({e})") print(f" DLQ: init failed ({e})")
await init_db() try:
await init_db()
except Exception as e:
print(f" DB init: failed ({e}) — will retry on first request")
yield yield
# Shutdown # Shutdown
stop_event.set() stop_event.set()