# News-Crawler (UDE 'aktuell'). Build from the repo root:
# docker build -f service/scripts/jobs-image/news-crawl/Dockerfile -t docker.nes.uni-due.de/inse/jobs/news-crawl:latest .
#
# scrapy<2.13 + Twisted<24.7 are load-bearing: the spiders use the removed
# start_requests() hook, and newer versions silently crawl 0 items.
FROM python:3.13-slim

WORKDIR /app
ENV PYTHONUNBUFFERED=1
# Upload the crawled articles into the shared test index (see upload_aktuell.py,
# which reads ELASTICSEARCH_INSE_* creds + NEWS_UPLOAD_INDEX from the env).
ENV NEWS_UPLOAD_INDEX=docker-job_test

COPY service/scripts/jobs-image/news-crawl/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY service/scripts/news/ude/ ./service/scripts/news/ude/

# Uncapped: crawls every article and uploads to NEWS_UPLOAD_INDEX. Limit a run by
# passing --max-items N through the job's command field.
ENTRYPOINT ["python", "service/scripts/news/ude/run_pipeline.py"]
