FROM python:3.12-alpine

ARG WCFERRY_VERSION=39.5.2.0
ARG PIP_INDEX_URL=http://mirrors.aliyun.com/pypi/simple/
ARG PIP_TRUSTED_HOST=mirrors.aliyun.com
ARG PIP_TIMEOUT_SECONDS=120
ARG PIP_RETRIES=8

RUN apk add --no-cache ca-certificates tzdata \
  && python -m pip install --no-cache-dir \
    --trusted-host "${PIP_TRUSTED_HOST}" \
    --index-url "${PIP_INDEX_URL}" \
    --timeout "${PIP_TIMEOUT_SECONDS}" \
    --retries "${PIP_RETRIES}" \
    "wcferry==${WCFERRY_VERSION}" \
  && python - <<'PY'
import importlib.metadata
print("wcferry", importlib.metadata.version("wcferry"))
PY

WORKDIR /app
COPY collector.py /app/collector.py

ENV PYTHONUNBUFFERED=1
CMD ["python", "/app/collector.py"]
