Randomly when I run my docker build i get a mail error halting CI. If I rerun the CI script in Gitlab once or twice woth no changes made to config it often successfully builds. I am at a loss as to why this is an intermittent issue and how to prevent it from happening. It appears to be an issue with the jit/zend_jit.lo dependeny in OPCache (possibly) as it only occurs when at this stage of the build.
My docker file is…
FROM php:8.0-apache
#Set The Project Work Directory
WORKDIR /var/www/html
#Copy The Application To The Web Directory
COPY . /var/www/html
# Install composer & app dependencies
COPY --from=composer:2.0.13 /usr/bin/composer /usr/local/bin/composer
# Add Apache Extensions
RUN a2enmod expires
# Install PHP extensions
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions bcmath gd pdo_mysql pdo_pgsql redis uuid zip sockets opcache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Run Composer Installation
RUN composer install --prefer-dist --no-scripts
# Copy Configuration Files
COPY docker/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY docker/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
# Copy Shell Execution Script
COPY docker/start.sh /usr/local/bin/start
# Change PRoject File Permissions
RUN chown -R www-data:www-data /var/www/html && chmod u+x /usr/local/bin/start && a2enmod rewrite
# Execute Shell Execution Script
CMD ["/usr/local/bin/start"]
The executing command in the Dockerfile is…
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions bcmath gd pdo_mysql pdo_pgsql redis uuid zip sockets opcache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
And the returned log in Gitlab pipeline is…
cc /usr/src/php/ext/opcache/jit/dynasm/minilua.c -lm -o minilua
make: Circular jit/zend_jit.lo <- jit/zend_jit.lo dependency dropped.
cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/Optimizer/compact_vars.c -fPIC -DPIC -o Optimizer/.libs/compact_vars.o
cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/Optimizer/zend_dump.c -fPIC -DPIC -o Optimizer/.libs/zend_dump.o
/bin/bash /usr/src/php/ext/opcache/libtool --mode=compile cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit_vm_helpers.c -o jit/zend_jit_vm_helpers.lo
mkdir jit/.libs
cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit_vm_helpers.c -fPIC -DPIC -o jit/.libs/zend_jit_vm_helpers.o
./minilua /usr/src/php/ext/opcache/jit/dynasm/dynasm.lua -D X64=1 -o jit/zend_jit_x86.c /usr/src/php/ext/opcache/jit/zend_jit_x86.dasc
/bin/bash /usr/src/php/ext/opcache/libtool --mode=compile cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit.c -o jit/zend_jit.lo
cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit.c -fPIC -DPIC -o jit/.libs/zend_jit.o
cc: fatal error: Killed signal terminated program cc1
compilation terminated.
make: *** [Makefile:299: jit/zend_jit.lo] Error 1
The command '/bin/sh -c install-php-extensions bcmath gd pdo_mysql pdo_pgsql redis uuid zip sockets opcache' returned a non-zero code: 2
Cleaning up file based variables 00:00
ERROR: Job failed: command terminated with exit code 2
I would still like to use OCache but am trying to avoid a unpredictable error from halting CI all the time and causing a restart of the pipeline.
Not sure if it makes a difference but I am not using the shared runners hosted by Gitlab I am using my own runners hosted on my Kubernetes cluster.