FROM php:8.1-cli


SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y --fix-missing
RUN apt update -y --fix-missing
RUN apt install -y tzdata git

# libraries for PHP
RUN apt install -y libcurl3-openssl-dev libxml2-dev libonig-dev libyaml-dev
# PHP Extensions
RUN docker-php-ext-install -j$(nproc) curl dom mbstring bcmath


RUN mkdir /tools; mkdir /tools/pan-os-php; mkdir /tools/pan-os-php/log;
COPY appid-toolbox /tools/pan-os-php/appid-toolbox
COPY lib /tools/pan-os-php/lib
COPY phpseclib /tools/pan-os-php/phpseclib
COPY git-php /tools/pan-os-php/git-php
COPY utils /tools/pan-os-php/utils
COPY tests /tools/pan-os-php/tests
COPY iron-skillet /tools/pan-os-php/iron-skillet
COPY migration /tools/pan-os-php/migration


# PHP library of pan-os-php
RUN echo 'include_path = "/usr/local/lib/php:/tools/pan-os-php"' >> /usr/local/etc/php/php.ini
RUN chmod -R 777 /tools/pan-os-php

RUN echo -e 'php -r "require_once '"'"'utils/pan-os-php.php'"'"';" $@' > /usr/bin/pan-os-php
RUN chmod 777 /usr/bin/pan-os-php

RUN git config --global user.email=test@test.com user.name=test
