# python:3.12-slim, not 3.13/3.14. The parser uses nothing newer than 3.10 syntax and
# 3.12 has the widest wheel coverage for the SDK; a bleeding-edge base turns a routine
# build into a dependency-resolution problem.
FROM python:3.12-slim

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . ./

RUN useradd --create-home --uid 1001 apify
USER apify

# NOT `python3 -m src.main`. Module mode imports src as a package, so the sibling
# `from parser import ...` in main.py cannot resolve and the Actor dies with
# "No module named 'parser'". Running the file directly puts src/ on sys.path.
CMD ["python3", "src/main.py", "--actor"]
