feat(market-intel): Implement fully functional, optimized backend
- Refactored market_intel_orchestrator.py for direct Gemini API (v1) calls.\n- Updated model to gemini-2.5-pro for enhanced capabilities.\n- Implemented minimal stdout logging for improved traceability within Docker.\n- Optimized Dockerfile and introduced market-intel.requirements.txt for leaner, faster builds.\n- Ensured end-to-end communication from React frontend through Node.js bridge to Python backend is fully functional.
This commit is contained in:
53
Dockerfile
53
Dockerfile
@@ -2,11 +2,11 @@
|
||||
# Nutzt ein Node.js Image als Basis und installiert Python und alle Abhängigkeiten.
|
||||
|
||||
# Phase 1: Build Stage für Python-Abhängigkeiten
|
||||
FROM node:20-slim as python-deps
|
||||
FROM node:20-slim as base
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Systemabhängigkeiten für Python-Builds (insbesondere grpcio)
|
||||
# Systemabhängigkeiten für Python-Builds und Runtime
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3 \
|
||||
python3-pip \
|
||||
@@ -16,40 +16,43 @@ RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Virtuelle Umgebung erstellen und aktivieren
|
||||
# Virtuelle Umgebung erstellen
|
||||
RUN python3 -m venv .venv
|
||||
ENV PATH="/app/.venv:$PATH"
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
# Python-Abhängigkeiten kopieren und installieren
|
||||
COPY requirements.txt .
|
||||
RUN /app/.venv/bin/pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Phase 2: Final Stage
|
||||
FROM node:20-slim
|
||||
# Phase 2: Python-Abhängigkeiten installieren (Caching optimiert)
|
||||
FROM base as python-deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Systemabhängigkeiten für den Runtime-Betrieb
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3 \
|
||||
# Optional: weitere Runtime-Abhängigkeiten hier hinzufügen, falls benötigt
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
# ZUERST nur die Anforderungsdatei kopieren und installieren
|
||||
# Dieser Layer wird nur neu gebaut, wenn sich die requirements-Datei ändert
|
||||
COPY market-intel.requirements.txt .
|
||||
RUN pip install --no-cache-dir -r market-intel.requirements.txt
|
||||
|
||||
# Venv aus der Build Stage kopieren
|
||||
# Phase 3: Final Stage (Anwendungscode hinzufügen)
|
||||
FROM base
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Venv mit den installierten Paketen aus der vorherigen Stage kopieren
|
||||
COPY --from=python-deps /app/.venv ./.venv
|
||||
ENV PATH="/app/.venv:$PATH"
|
||||
|
||||
# Node.js-Anwendung und Python-Skript kopieren
|
||||
# ZUERST nur die package.json kopieren und npm install ausführen
|
||||
# Dieser Layer wird nur neu gebaut, wenn sich package.json ändert
|
||||
COPY general-market-intelligence/package*.json ./general-market-intelligence/
|
||||
COPY general-market-intelligence/server.cjs ./general-market-intelligence/
|
||||
COPY general-market-intelligence/.gitignore ./general-market-intelligence/
|
||||
COPY market_intel_orchestrator.py .
|
||||
COPY gemini_api_key.txt .
|
||||
COPY tmp tmp/
|
||||
|
||||
# Node.js-Abhängigkeiten installieren
|
||||
RUN cd general-market-intelligence && npm install --no-cache
|
||||
|
||||
# DANACH den restlichen Anwendungscode kopieren
|
||||
COPY general-market-intelligence/server.cjs ./general-market-intelligence/
|
||||
COPY market_intel_orchestrator.py .
|
||||
COPY helpers.py .
|
||||
COPY config.py .
|
||||
COPY gemini_api_key.txt .
|
||||
|
||||
# Sicherstellen, dass das tmp-Verzeichnis existiert
|
||||
RUN mkdir -p general-market-intelligence/tmp
|
||||
|
||||
# Umgebungsvariablen setzen (API Key wird aus Datei geladen, hier nur als Beispiel)
|
||||
# ENV GEMINI_API_KEY="your_gemini_api_key_here" # Besser: Als bind mount oder Secret managen
|
||||
|
||||
|
||||
Reference in New Issue
Block a user