- Add shared/ module: config, db, models, schemas, redis utilities - Add Auth Service (services/auth/): register, login, refresh, me, ForwardAuth /verify endpoint for Traefik - Add Traefik config: ACME/Cloudflare DNS-01, dynamic routing, ForwardAuth middleware, sticky sessions for WS Gateway - Add service scaffolds: ws-gateway, chat, batch-agent, billing (READMEs) - Add redis>=5.0.0 to requirements.txt - Monolith app/ is untouched — strangler fig migration
37 lines
1.2 KiB
Docker
37 lines
1.2 KiB
Docker
# ── builder ──────────────────────────────────────────────────────────────────
|
|
FROM python:3.12-slim AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
# Install shared + service deps in one layer
|
|
COPY services/auth/requirements.txt ./requirements.txt
|
|
RUN pip install --upgrade pip && \
|
|
pip install --no-cache-dir --prefix=/install -r requirements.txt
|
|
|
|
# ── runtime ──────────────────────────────────────────────────────────────────
|
|
FROM python:3.12-slim AS runtime
|
|
|
|
RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /install /usr/local
|
|
|
|
# Copy shared module (available to all services)
|
|
COPY shared/ shared/
|
|
|
|
# Copy service source
|
|
COPY services/auth/app/ app/
|
|
|
|
RUN chown -R appuser:appgroup /app
|
|
|
|
USER appuser
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["gunicorn", "app.main:app", \
|
|
"-k", "uvicorn.workers.UvicornWorker", \
|
|
"--bind", "0.0.0.0:8000", \
|
|
"--workers", "2", \
|
|
"--timeout", "30"]
|