mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +00:00
Root cause: sqlite_patch checked `if "sqlite" in db_url` but db_url was empty string when DATABASE_URL env var not set. Patch was skipped, then models used PostgreSQL types (JSONB/Vector) with SQLite compiler causing crash: "can't render element of type JSONB". Fix: `if not db_url or "sqlite" in db_url` — apply patch when URL is empty (defaults to SQLite anyway in database.py). Also: - Dockerfile: add libxml2/libxslt1.1 for lxml runtime - Dockerfile: increase healthcheck start-period to 120s - start.sh: log DATABASE_URL prefix for debugging https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
46 lines
1.3 KiB
Docker
46 lines
1.3 KiB
Docker
# ── Stage 1: Builder ──────────────────────────────────
|
|
FROM python:3.12-slim AS builder
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential libpq-dev curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /build
|
|
|
|
RUN python -m venv /opt/venv
|
|
ENV PATH="/opt/venv/bin:$PATH"
|
|
|
|
COPY requirements.txt ./
|
|
ARG CACHEBUST=2
|
|
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
|
|
&& pip install --no-cache-dir -r requirements.txt
|
|
|
|
# ── Stage 2: Runtime ─────────────────────────────────
|
|
FROM python:3.12-slim AS runtime
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libpq5 curl tini libxml2 libxslt1.1 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN groupadd --gid 1000 app \
|
|
&& useradd --uid 1000 --gid app --shell /bin/bash --create-home app
|
|
|
|
COPY --from=builder /opt/venv /opt/venv
|
|
ENV PATH="/opt/venv/bin:$PATH" \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1
|
|
|
|
WORKDIR /app
|
|
COPY --chown=app:app . .
|
|
RUN chmod +x start.sh
|
|
|
|
USER app
|
|
|
|
EXPOSE 8000
|
|
|
|
HEALTHCHECK --interval=20s --timeout=15s --start-period=120s --retries=5 \
|
|
CMD curl -f http://localhost:${PORT:-8000}/health || exit 1
|
|
|
|
ENTRYPOINT ["tini", "--"]
|
|
CMD ["./start.sh"]
|