FROM php:8.2-cli

ENV TZ "${TZ}"
ENV APP_NAME "${APP_NAME}"
ENV API_URL "${API_URL}"

RUN apt-get update && apt-get install -y --no-install-recommends cron rsyslog nano && rm -r /var/lib/apt/lists/*

RUN pecl install xdebug-3.2.2 \
    && docker-php-ext-enable xdebug \
    && echo "#/bin/bash\nprintenv >> /etc/environment\ncron -f -L 11" > /root/entrypoint && chmod a+x /root/entrypoint

COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini

WORKDIR /code/bin

COPY --chmod=644 ./cli/crontab /var/spool/cron/crontabs/root

CMD [ "/root/entrypoint" ]
