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

RUN php -r 'foreach (["curl", "sqlite3", "pdo_sqlite"] as $extension) { if (!extension_loaded($extension)) { fwrite(STDERR, "Missing PHP extension: {$extension}\n"); exit(1); } }'

WORKDIR /opt/truckwash-edge-agent

COPY agent.php /opt/truckwash-edge-agent/agent.php

ENTRYPOINT ["php", "/opt/truckwash-edge-agent/agent.php"]
CMD ["--config", "/config/config.json"]
