b8238e03ea
- backend/Dockerfile: run migrations via start.sh before uvicorn instead of launching uvicorn directly (prod was skipping Alembic) - backend/scripts/start.sh: alembic upgrade head + uvicorn exec - documents_proxy.py: add explicit "" route so GET /api/documents (no trailing slash) returns 200 instead of 307 redirect - README.md: update Containers table, volumes section, and Current State to reflect the new 4-container architecture with doc-service Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
1.1 KiB
Docker
35 lines
1.1 KiB
Docker
# ── Stage 1: dependency installation ─────────────────────────────────────────
|
|
FROM python:3.12-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
RUN pip install --upgrade pip
|
|
|
|
COPY pyproject.toml .
|
|
RUN pip install --prefix=/install .
|
|
|
|
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
|
|
FROM python:3.12-slim
|
|
|
|
# Create non-root user (UID/GID 1001)
|
|
RUN groupadd --gid 1001 appuser && \
|
|
useradd --uid 1001 --gid 1001 --no-create-home --shell /bin/sh appuser
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy installed packages from builder
|
|
COPY --from=builder /install /usr/local
|
|
|
|
# Copy application source with correct ownership
|
|
COPY --chown=appuser:appuser app ./app
|
|
COPY --chown=appuser:appuser alembic ./alembic
|
|
COPY --chown=appuser:appuser alembic.ini .
|
|
COPY --chown=appuser:appuser scripts ./scripts
|
|
RUN chmod +x scripts/start.sh
|
|
|
|
USER appuser
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["sh", "scripts/start.sh"]
|