multi-stage Dockerfile + player recap styles
Dockerfile: split into whisperx-base and runtime stages so app-only changes skip the 10min pip install on rebuild. Example compose updated. Player recap: replace hardcoded 'story so far' prompt with selectable styles (story/diary/bullets/custom) via dropdown in Setup and Settings. Settings: add NAT20_ONBOARDING_COMPLETED env var; fix merge logic so env vars properly override defaults (not just empty DB values).
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# ==========================================
|
||||
# STAGE 1: Builder Environment
|
||||
# STAGE 1 — builder: compile Python deps
|
||||
# ==========================================
|
||||
# Changes only when requirements.txt is modified.
|
||||
FROM python:3.11-slim AS builder
|
||||
|
||||
WORKDIR /build
|
||||
@@ -28,25 +29,32 @@ RUN find /root/.local -type d -name "__pycache__" -exec rm -rf {} + \
|
||||
&& find /root/.local -name "*.dist-info" -exec sh -c 'rm -f "$1"/RECORD "$1"/INSTALLER' _ {} \;
|
||||
|
||||
# ==========================================
|
||||
# STAGE 2: Lightweight Final Runtime
|
||||
# STAGE 2 — whisperx-base: deps only, no app
|
||||
# ==========================================
|
||||
FROM python:3.11-slim AS runtime
|
||||
# Targeted by docker-compose for dev caching.
|
||||
# If you only need this layer: docker build --target=whisperx-base -t nat20-whisperx-base .
|
||||
FROM python:3.11-slim AS whisperx-base
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# ffmpeg is mandatory for the audio-extraction step.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the (now stripped) site-packages from the builder stage. None of the
|
||||
# build-essential/gcc toolchain from Stage 1 ends up here.
|
||||
COPY --from=builder /root/.local /root/.local
|
||||
COPY app /app/app
|
||||
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# ==========================================
|
||||
# STAGE 3 — runtime: full release image
|
||||
# ==========================================
|
||||
# Build for production: docker build --target=runtime -t nat20-notes-backend .
|
||||
# Layers app code on top of whisperx-base in a single Dockerfile pass.
|
||||
FROM whisperx-base AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY app /app/app
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
Reference in New Issue
Block a user