# Bund-Crawler (foerderportal export via headless Chrome). Build from the repo root:
# docker build -f service/scripts/jobs-image/bund-crawl/Dockerfile -t docker.nes.uni-due.de/inse/jobs/bund-crawl:latest .
FROM python:3.13-slim

WORKDIR /app
ENV PYTHONUNBUFFERED=1
# Upload the crawled projects into the shared test index (gpc.data.py reads
# ELASTICSEARCH_INSE_* creds + BUND_UPLOAD_INDEX from the env).
ENV BUND_UPLOAD_INDEX=docker-job_test

# Headless Chrome for the Selenium crawler.
RUN apt-get update \
    && apt-get install -y --no-install-recommends chromium chromium-driver \
    && rm -rf /var/lib/apt/lists/*
ENV CHROME_BIN=/usr/bin/chromium \
    CHROMEDRIVER_PATH=/usr/bin/chromedriver

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

COPY service/scripts/projects/bund/ ./service/scripts/projects/bund/

WORKDIR /app/service/scripts/projects/bund

# Capped on purpose: the full export is ~300k rows, so an uncapped run would
# write that entire volume into BUND_UPLOAD_INDEX. Raise or drop the cap by
# passing --max-rows N through the job's command field.
ENTRYPOINT ["python", "gpc.data.py", "--max-rows", "200"]
