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:
@@ -1,19 +1,19 @@
|
|||||||
# --- STAGE 1: Builder ---
|
# --- STAGE 1: Builder ---
|
||||||
FROM python:3.9-slim AS builder
|
FROM python:3.11-slim AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install system dependencies needed for building
|
# Install system dependencies needed for building
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install dependencies into a local directory
|
# Install dependencies into a local directory
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --user --no-cache-dir -r requirements.txt
|
RUN pip install --user --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# --- STAGE 2: Runtime ---
|
# --- STAGE 2: Runtime ---
|
||||||
FROM python:3.9-slim
|
FROM python:3.11-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,31 @@
|
|||||||
FROM python:3.9-slim
|
# --- STAGE 1: Builder ---
|
||||||
|
FROM python:3.11-slim AS builder
|
||||||
WORKDIR /app
|
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
|
# Install python dependencies
|
||||||
RUN pip install streamlit pandas requests python-dotenv fastapi "uvicorn[standard]" msal
|
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
|
ENV PYTHONUNBUFFERED=1
|
||||||
EXPOSE 8501
|
EXPOSE 8501
|
||||||
EXPOSE 8004
|
EXPOSE 8004
|
||||||
|
|
||||||
# Start monitor in background and streamlit in foreground
|
# 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"]
|
CMD ["sh", "-c", "python monitor.py & streamlit run app.py --server.port=8501 --server.address=0.0.0.0"]
|
||||||
|
|
||||||
|
|||||||
7
lead-engine/requirements.txt
Normal file
7
lead-engine/requirements.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
streamlit
|
||||||
|
pandas
|
||||||
|
requests
|
||||||
|
python-dotenv
|
||||||
|
fastapi
|
||||||
|
uvicorn[standard]
|
||||||
|
msal
|
||||||
@@ -6,19 +6,25 @@ RUN npm install
|
|||||||
COPY frontend/ ./
|
COPY frontend/ ./
|
||||||
RUN npm run build
|
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
|
FROM python:3.11-slim
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# System Dependencies (FFmpeg ist essenziell)
|
# 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 \
|
ffmpeg \
|
||||||
build-essential \
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Copy Requirements & Install
|
# Copy Installed Packages
|
||||||
COPY backend/requirements.txt .
|
COPY --from=backend-builder /root/.local /root/.local
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
ENV PATH=/root/.local/bin:$PATH
|
||||||
|
|
||||||
# Copy Built Frontend from Stage 1
|
# Copy Built Frontend from Stage 1
|
||||||
COPY --from=frontend-builder /build/dist /frontend_static
|
COPY --from=frontend-builder /build/dist /frontend_static
|
||||||
@@ -34,4 +40,4 @@ ENV PYTHONUNBUFFERED=1
|
|||||||
EXPOSE 8001
|
EXPOSE 8001
|
||||||
|
|
||||||
# Start FastAPI
|
# 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"]
|
||||||
Reference in New Issue
Block a user