This commit is contained in:
2025-11-11 14:22:21 +01:00
parent 1075a91eac
commit 760a458e66
4 changed files with 19 additions and 23 deletions

View File

@@ -1,5 +1,3 @@
version: '3.8'
services: services:
# MongoDB Database # MongoDB Database
mongodb: mongodb:
@@ -39,9 +37,6 @@ services:
- TZ=Europe/Berlin - TZ=Europe/Berlin
volumes: volumes:
- ./backend/.env:/app/.env:ro - ./backend/.env:/app/.env:ro
- ./backend/config.py:/app/config.py:ro
- ./backend/ollama_client.py:/app/ollama_client.py:ro
- ./news_crawler:/app:ro
networks: networks:
- munich-news-network - munich-news-network
healthcheck: healthcheck:
@@ -92,8 +87,6 @@ services:
- TZ=Europe/Berlin - TZ=Europe/Berlin
volumes: volumes:
- ./backend/.env:/app/.env:ro - ./backend/.env:/app/.env:ro
- ./backend/services:/app/backend/services:ro
- ./news_sender:/app:ro
networks: networks:
- munich-news-network - munich-news-network
healthcheck: healthcheck:

View File

@@ -2,17 +2,15 @@ FROM python:3.11-slim
WORKDIR /app WORKDIR /app
# Install dependencies # Copy requirements first for better caching
COPY requirements.txt . COPY news_crawler/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Copy crawler files # Copy backend config (needed for Config class)
COPY . . COPY backend/config.py /app/config.py
# Copy backend config files (needed for Config class) # Copy crawler files (includes ollama_client.py)
COPY ../backend/config.py /app/config.py COPY news_crawler/ /app/
COPY ../backend/ollama_client.py /app/ollama_client.py
COPY ../backend/.env /app/.env
# Make the scheduler executable # Make the scheduler executable
RUN chmod +x scheduled_crawler.py RUN chmod +x scheduled_crawler.py

View File

@@ -2,16 +2,17 @@ FROM python:3.11-slim
WORKDIR /app WORKDIR /app
# Install dependencies # Copy requirements first for better caching
COPY requirements.txt . COPY news_sender/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Copy sender files # Copy backend dependencies (needed for tracking)
COPY . . COPY backend/services /app/backend/services
COPY backend/database.py /app/backend/database.py
COPY backend/config.py /app/backend/config.py
# Copy backend files (needed for tracking and config) # Copy sender files
COPY ../backend/services /app/backend/services COPY news_sender/ /app/
COPY ../backend/.env /app/.env
# Make the scheduler executable # Make the scheduler executable
RUN chmod +x scheduled_sender.py RUN chmod +x scheduled_sender.py

View File

@@ -15,6 +15,10 @@ import sys
from dotenv import load_dotenv from dotenv import load_dotenv
# Add backend directory to path for importing tracking service # Add backend directory to path for importing tracking service
# Check if running in Docker (backend is at /app/backend) or locally (../backend)
if Path('/app/backend').exists():
backend_dir = Path('/app/backend')
else:
backend_dir = Path(__file__).parent.parent / 'backend' backend_dir = Path(__file__).parent.parent / 'backend'
sys.path.insert(0, str(backend_dir)) sys.path.insert(0, str(backend_dir))