ARG BASE_IMAGE=php:8.2-cli-bookworm
FROM ${BASE_IMAGE}

RUN set -eux; \
    apt-get update; \
    apt-get install -y --no-install-recommends bash ca-certificates curl docker.io docker-compose; \
    php -r 'foreach (["curl", "sqlite3", "pdo_sqlite"] as $extension) { if (!extension_loaded($extension)) { fwrite(STDERR, "Missing PHP extension: {$extension}\n"); exit(1); } }'; \
    rm -rf /var/lib/apt/lists/*

COPY auto-updater.php /usr/local/bin/auto-updater.php

ENTRYPOINT ["php", "/usr/local/bin/auto-updater.php"]
