FROM python:3.11-slim

WORKDIR /app

# Copy requirements first for better caching
COPY news_crawler/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy backend config (needed for Config class)
COPY backend/config.py /app/config.py

# Copy crawler files (includes ollama_client.py)
COPY news_crawler/ /app/

# Make scripts executable
RUN chmod +x scheduled_crawler.py start.sh

# Set timezone to Berlin
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Run both scheduler and worker
CMD ["/app/start.sh"]
