perf: [30388f42] Docker-Optimierung (Lead-Engine, Heatmap, Transcription)

- Konvertiert lead-engine/Dockerfile zu Multi-Stage Build mit requirements.txt.
- Aktualisiert heatmap-tool und transcription-tool auf Python 3.11-slim.
- Entfernt unnötige Build-Tools (build-essential) aus den Runtime-Images.
- Deaktiviert --reload Modus für Produktionsstabilität.
This commit is contained in:
2026-03-06 16:53:21 +00:00
parent 5b9f08c4f3
commit 533213e6df
4 changed files with 45 additions and 16 deletions

View File

@@ -1,19 +1,19 @@
# --- STAGE 1: Builder ---
FROM python:3.9-slim AS builder
FROM python:3.11-slim AS builder
WORKDIR /app
# Install system dependencies needed for building
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install dependencies into a local directory
COPY requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt
# --- STAGE 2: Runtime ---
FROM python:3.9-slim
FROM python:3.11-slim
WORKDIR /app

View File

@@ -1,15 +1,31 @@
FROM python:3.9-slim
# --- STAGE 1: Builder ---
FROM python:3.11-slim AS builder
WORKDIR /app
COPY . .
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies required for ingestion and DB
RUN pip install streamlit pandas requests python-dotenv fastapi "uvicorn[standard]" msal
# Install python dependencies
COPY requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt
# --- STAGE 2: Runtime ---
FROM python:3.11-slim
WORKDIR /app
# Copy installed packages
COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
# Copy app code
COPY . .
ENV PYTHONUNBUFFERED=1
EXPOSE 8501
EXPOSE 8004
# Start monitor in background and streamlit in foreground
CMD ["sh", "-c", "python monitor.py & streamlit run app.py --server.port=8501 --server.address=0.0.0.0"]

View File

@@ -0,0 +1,7 @@
streamlit
pandas
requests
python-dotenv
fastapi
uvicorn[standard]
msal

View File

@@ -6,19 +6,25 @@ RUN npm install
COPY frontend/ ./
RUN npm run build
# --- STAGE 2: Backend & Runtime ---
# --- STAGE 2: Backend Builder ---
FROM python:3.11-slim AS backend-builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/*
COPY backend/requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt
# --- STAGE 3: Final Runtime ---
FROM python:3.11-slim
WORKDIR /app
# System Dependencies (FFmpeg ist essenziell)
RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
build-essential \
&& rm -rf /var/lib/apt/lists/*
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy Requirements & Install
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy Installed Packages
COPY --from=backend-builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
# Copy Built Frontend from Stage 1
COPY --from=frontend-builder /build/dist /frontend_static
@@ -34,4 +40,4 @@ ENV PYTHONUNBUFFERED=1
EXPOSE 8001
# Start FastAPI
CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "8001", "--reload"]
CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "8001"]