diff --git a/Dockerfile b/Dockerfile index 9c81975..dc11af9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,41 +1,42 @@ -FROM amazonlinux:2 +FROM rockylinux:9 +# Set arguments for directory paths ARG PHP_BUILD_DIR=/var/task ARG PHP_CONF_DIR=/etc/php.d ARG PHP_EXT_DIR=/usr/lib64/php/modules -RUN yum install -y amazon-linux-extras -RUN amazon-linux-extras enable php8.2 -RUN amazon-linux-extras install -y php8.2 -RUN yum clean all && \ - yum -y upgrade && \ - yum -y install ilibzip-dev libonig-dev putils gcc make \ - yum -y re2c \ - yum-utils +# Enable CRB and install required tools, resolving conflicts +RUN dnf -y update && \ + dnf -y install dnf-plugins-core && \ + dnf config-manager --set-enabled crb && \ + dnf -y install curl --allowerasing && \ + dnf -y install dnf-utils wget tar gcc make libxml2-devel \ + bzip2 bzip2-devel libpng-devel libjpeg-devel \ + freetype-devel oniguruma-devel libzip-devel zlib-devel -RUN yum -y install php-cli php-common php-devel && \ - yum clean all +# Enable Remi repository for PHP 8.4 +RUN dnf -y install https://rpms.remirepo.net/enterprise/remi-release-9.rpm && \ + dnf module reset php -y && \ + dnf module enable php:remi-8.4 -y && \ + dnf -y install php php-cli php-devel php-pear -#Extension install -RUN mkdir -p ${PHP_EXT_DIR} && mkdir -p ${PHP_CONF_DIR} +# Prepare directories for building the PHP extension +RUN mkdir -p ${PHP_BUILD_DIR}/shadow -#shadow -RUN mkdir -p ${PHP_BUILD_DIR} -RUN cd ${PHP_BUILD_DIR} && \ - mkdir shadow -COPY shadow.c shadow/ -COPY php_shadow.h shadow/ -COPY shadow_cache.c shadow/ -COPY shadow_cache.h shadow/ -COPY config.m4 shadow/ -COPY shadow_diff.php shadow/ -COPY tests shadow/ -COPY sugarcrm shadow/ -RUN cd shadow && \ +# Copy extension source files +COPY shadow.c php_shadow.h shadow_cache.c shadow_cache.h config.m4 ${PHP_BUILD_DIR}/shadow/ +COPY tests ${PHP_BUILD_DIR}/shadow/tests/ +COPY shadow_diff.php ${PHP_BUILD_DIR}/shadow/ +COPY sugarcrm ${PHP_BUILD_DIR}/shadow/sugarcrm/ + +# Build and install the PHP extension +RUN cd ${PHP_BUILD_DIR}/shadow && \ phpize && \ ./configure && \ make && \ make install && \ - echo "extension=${PHP_EXT_DIR}/shadow.so" > ${PHP_CONF_DIR}/shadow.ini -RUN cd shadow && \ + echo "extension=shadow.so" > ${PHP_CONF_DIR}/shadow.ini + +# Run tests for the PHP extension +RUN cd ${PHP_BUILD_DIR}/shadow && \ php run-tests.php --show-diff .