Skip to content

Working on PHP 8.4 build#12

Merged
SilverFire merged 6 commits intomasterfrom
8.4
Nov 27, 2024
Merged

Working on PHP 8.4 build#12
SilverFire merged 6 commits intomasterfrom
8.4

Conversation

@SilverFire
Copy link
Copy Markdown
Member

@SilverFire SilverFire commented Nov 27, 2024

Summary by CodeRabbit

  • New Features

    • Introduced PHP 8.4 CLI and FPM environments based on Alpine Linux.
    • Added a new entry point script for configuring Docker containers with Postfix and New Relic settings.
  • Improvements

    • Enhanced build process for PHP images with versioning and multiple build targets.
    • Optimized Dockerfiles to include necessary PHP extensions and tools while reducing image size.
    • Updated minimum version requirement for periodic updates in the workflow.
  • Bug Fixes

    • Improved configuration for XDebug and Opcache settings based on environment variables.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 27, 2024

Walkthrough

The changes introduce a new Makefile and Dockerfiles for PHP version 8.4, establishing build processes for both CLI and FPM environments based on Alpine Linux. The Makefile defines a build process with targets for creating and pushing Docker images. The Dockerfiles configure PHP environments with necessary extensions and settings, while a new entrypoint script manages container configuration for New Relic and Postfix, adapting settings based on environment variables. Additionally, the GitHub Actions workflow is updated to reflect a new minimum version requirement for periodic updates.

Changes

File Change Summary
src/8.4/Makefile Added variables VERSION and builds, defined target all, and added build and push targets.
src/8.4/cli-alpine/Dockerfile Created Dockerfile for PHP 8.4 CLI, configuring environment variables, installing dependencies, and PHP extensions.
src/8.4/fpm-alpine/Dockerfile Created Dockerfile for PHP 8.4 FPM, setting up environment variables, installing dependencies, and configuring PHP settings.
src/8.4/fpm-alpine/hiqdev-docker-entrypoint Added new script for Docker container configuration, managing Postfix and New Relic settings based on environment variables.
.github/workflows/main.yaml Updated environment variable PERIODIC_UPDATES_MIN_VERSION from 7.4 to 8.3.

Poem

In the land of code where rabbits hop,
PHP 8.4, we cheer and stop!
With Docker images, oh so bright,
Builds and pushes, what a delight!
New scripts to guide our way,
Hooray for changes, hip-hip-hooray! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c87469a and 8a8dd04.

📒 Files selected for processing (2)
  • src/8.4/cli-alpine/Dockerfile (1 hunks)
  • src/8.4/fpm-alpine/Dockerfile (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/8.4/cli-alpine/Dockerfile
  • src/8.4/fpm-alpine/Dockerfile

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Outside diff range and nitpick comments (9)
src/8.4/cli-alpine/Dockerfile (5)

4-4: Consider using a stable XDebug release instead of a beta version

You have specified XDEBUG_RELEASE=3.4.0beta1, which is a beta version. For production environments, it's recommended to use stable releases to ensure reliability and avoid potential issues associated with beta versions.


45-45: Remove duplicate zlib-dev from build dependencies

The package zlib-dev is listed twice in the .build-deps virtual package. This redundancy can be eliminated to simplify the build process.

Apply this diff to remove the duplicate entry:

            $PHPIZE_DEPS \
            zlib-dev \
            icu-dev \
            g++ \
            freetype-dev \
            libpng-dev \
            imagemagick-dev \
            libjpeg-turbo-dev \
            ghc \
            autoconf \
            krb5-dev \
            libssh2-dev \
-           zlib-dev \
            patch \

Also applies to: 56-56


52-52: Verify the necessity of installing ghc

The ghc (Glasgow Haskell Compiler) package is included in the .build-deps. Unless there's a specific requirement to compile Haskell code during the build process, consider removing it to reduce image size and build time.


106-106: Reconsider preloading libiconv using LD_PRELOAD

Using LD_PRELOAD to load /usr/lib/preloadable_libiconv.so is a workaround that may introduce unpredictable behavior. It's better to address the root cause by ensuring proper iconv support within the base image or PHP configuration.

Would you like assistance in finding an alternative solution to handle character encoding without preloading libiconv?


19-32: Optimize package installation to reduce image size

Packages like imagemagick, ghostscript, libssh2, and icu are installed in .php-deps. If they're only required for building extensions and not needed at runtime, consider moving them to .build-deps to minimize the final image size.

src/8.4/fpm-alpine/Dockerfile (3)

119-119: Use caution when setting LD_PRELOAD for libiconv

Setting LD_PRELOAD to /usr/lib/preloadable_libiconv.so can lead to unexpected behavior and potential conflicts within the container environment.

Instead of using LD_PRELOAD, consider installing a compatible version of libiconv or ensuring that all dependencies are properly linked at build time. This avoids the need for runtime library overrides.

If libiconv is necessary, you may compile PHP with the required flags or use packages that do not require this workaround.


134-135: Properly disable Xdebug extension

Disabling Xdebug by commenting out the first line of its .ini file may not fully prevent it from loading. This approach can be unreliable.

A better practice is to remove the Xdebug configuration file or use the phpdismod command to disable the extension.

Apply this diff:

-&& sed -i "1s/^/;/" /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
+&& rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \

This ensures that Xdebug is entirely disabled. When needed, you can enable it by copying the configuration file back into the conf.d directory.


53-53: Duplicate package installation: zlib-dev

The package zlib-dev is listed twice in the build dependencies, which is unnecessary.

Remove the duplicate entry to keep the Dockerfile clean.

Apply this diff:

&& apk add --no-cache --virtual .build-deps \
    $PHPIZE_DEPS \
    zlib-dev \
    icu-dev \
    g++ \
    freetype-dev \
    libpng-dev \
    imagemagick-dev \
    libjpeg-turbo-dev \
    autoconf \
    krb5-dev \
    libssh2-dev \
-   zlib-dev \
    patch \
&& \

Also applies to: 64-64

src/8.4/fpm-alpine/hiqdev-docker-entrypoint (1)

27-27: Correct the typo in the comment: 'Diable' → 'Disable'

There's a minor typo in the comment. It should be "Disable Opcache" instead of "Diable Opcache".

Apply this diff to fix the typo:

- # Diable Opcache
+ # Disable Opcache
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1c6efac and b80b65f.

📒 Files selected for processing (4)
  • src/8.4/Makefile (1 hunks)
  • src/8.4/cli-alpine/Dockerfile (1 hunks)
  • src/8.4/fpm-alpine/Dockerfile (1 hunks)
  • src/8.4/fpm-alpine/hiqdev-docker-entrypoint (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/8.4/Makefile
🔇 Additional comments (3)
src/8.4/cli-alpine/Dockerfile (1)

88-89: ⚠️ Potential issue

Fix potential syntax error in command chaining

The docker-php-ext-install opcache \ command ends with a backslash indicating continuation, but there's no command on the next line. This could lead to a syntax error during the build process. Ensure that command chaining is correctly structured.

Apply this diff to fix the command:

-        docker-php-ext-install opcache \
+        docker-php-ext-install opcache && \

Likely invalid or redundant comment.

src/8.4/fpm-alpine/Dockerfile (2)

20-20: Verify error_reporting directive is correctly set

The PHP_ERROR_REPORTING environment variable includes quotes, which might lead to unintended literal quotes in the php.ini configuration.

Ensure that the error_reporting directive receives the intended value without extra quotes.

Apply this diff to remove quotes from the environment variable and correctly set quotes in the configuration:

-ENV PHP_ERROR_REPORTING="E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE"
+ENV PHP_ERROR_REPORTING=E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE

And adjust the echo command:

-echo "error_reporting = $PHP_ERROR_REPORTING"; \
+echo "error_reporting = \"$PHP_ERROR_REPORTING\""; \

This change ensures that php.ini contains the correct error_reporting value.

Also applies to: 168-168


145-149: Verify sed commands correctly update PHP-FPM configuration

The sed commands are intended to update the PHP-FPM configuration in www.conf. Ensure that these commands correctly match and replace the desired lines.

Run the following script to confirm the configurations have been updated:

Expected output:

pm.max_children = 300
pm.start_servers = 50
pm.min_spare_servers = 20
pm.max_spare_servers = 50

Ensure that the output matches the expected values to confirm that the sed commands worked as intended.

✅ Verification successful

The sed commands for PHP-FPM configuration are correctly implemented

The verification of the sed commands in the Dockerfile shows that:

  1. The commands are properly formatted and use correct regex patterns to match and replace the configuration values
  2. The environment variables (FPM_MAX_CHILDREN, FPM_START_SERVERS, etc.) are defined at the beginning of the Dockerfile
  3. The modifications are part of a Docker build process where the base image (php:8.4-fpm-alpine) provides the default www.conf

The reason we couldn't verify the actual file content is that the changes happen during the Docker image build process, not in the repository itself. The sed commands will modify the configuration file that exists in the base PHP-FPM image.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that PHP-FPM settings have been applied.

# Check the updated values in www.conf
grep -E "^pm\.(max_children|max_spare_servers|min_spare_servers|start_servers)" /usr/local/etc/php-fpm.d/www.conf

Length of output: 182


Script:

#!/bin/bash
# Let's first check if the www.conf file exists in the repository
fd "www.conf"

# Let's also check the Dockerfile content to understand the context better
cat "src/8.4/fpm-alpine/Dockerfile"

Length of output: 6403

# Sockets
&& docker-php-ext-install sockets \

&& apk add gnu-libiconv="$GNU_LIBICONV_RELEASE" --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ --allow-untrusted \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid using the --allow-untrusted flag when installing packages

The use of --allow-untrusted bypasses package signature verification, posing a security risk. It's advisable to remove this flag to ensure all installed packages are verified.

Apply this diff to remove the --allow-untrusted flag:

-    && apk add gnu-libiconv="$GNU_LIBICONV_RELEASE" --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ --allow-untrusted \
+    && apk add gnu-libiconv="$GNU_LIBICONV_RELEASE" --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
&& apk add gnu-libiconv="$GNU_LIBICONV_RELEASE" --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ --allow-untrusted \
&& apk add gnu-libiconv="$GNU_LIBICONV_RELEASE" --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ \

FROM php:8.4-fpm-alpine

ENV POSTFIX_MAILNAME hiqdev.com
ENV XDEBUG_RELEASE=3.4.0beta1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid using beta versions of Xdebug in production

The Dockerfile sets XDEBUG_RELEASE to a beta version (3.4.0beta1). Using beta software in production environments can introduce instability and unexpected behavior.

Consider using the latest stable release of Xdebug. Update the XDEBUG_RELEASE environment variable accordingly.

Apply this diff:

-ENV XDEBUG_RELEASE=3.4.0beta1
+ENV XDEBUG_RELEASE=3.3.1  # Replace with the latest stable version

Also applies to: 92-94

libpng-dev \
imagemagick-dev \
libjpeg-turbo-dev \
ghc \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Unnecessary package installation: ghc

The ghc (Glasgow Haskell Compiler) package is being installed but is likely unnecessary for building PHP extensions or running PHP applications. Including it increases the image size significantly.

Consider removing ghc from the list of build dependencies to optimize the image size.

Apply this diff:

&& apk add --no-cache --virtual .build-deps \
    $PHPIZE_DEPS \
    zlib-dev \
    icu-dev \
    g++ \
    freetype-dev \
    libpng-dev \
    imagemagick-dev \
    libjpeg-turbo-dev \
-   ghc \
    autoconf \
    krb5-dev \
    libssh2-dev \
    zlib-dev \
    patch \
&& \

Committable suggestion skipped: line range outside the PR's diff.

Comment thread src/8.4/fpm-alpine/Dockerfile Outdated
Comment on lines +111 to +113
&& curl -L https://download.newrelic.com/php_agent/archive/$NEW_RELIC_AGENT_VERSION/newrelic-php5-$NEW_RELIC_AGENT_VERSION-linux-musl.tar.gz | tar -C /tmp -zx \
&& NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 /tmp/newrelic-php5-$NEW_RELIC_AGENT_VERSION-linux-musl/newrelic-install install \
&& rm -rf /tmp/newrelic-php5-* /tmp/nrinstall* \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Undefined environment variable: NEW_RELIC_AGENT_VERSION

The NEW_RELIC_AGENT_VERSION environment variable is used in the New Relic installation commands but is not defined in the Dockerfile. This will cause build failures due to an undefined variable.

To fix this issue, define the NEW_RELIC_AGENT_VERSION variable at the beginning of the Dockerfile with the appropriate version.

Apply this diff to add the missing environment variable:

+ENV NEW_RELIC_AGENT_VERSION=9.18.1.303  # Replace with the desired version

Committable suggestion skipped: line range outside the PR's diff.

# Sockets
&& docker-php-ext-install sockets \

&& apk add gnu-libiconv=$GNU_LIBICONV_RELEASE --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ --allow-untrusted \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Security risk: Using --allow-untrusted with apk add

The --allow-untrusted flag bypasses package signature verification, which exposes the system to potential security risks by installing unverified packages.

It's recommended to remove the --allow-untrusted flag and ensure packages are installed from trusted sources with proper signature verification.

Apply this diff:

-&& apk add gnu-libiconv=$GNU_LIBICONV_RELEASE --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ --allow-untrusted \
+&& apk add gnu-libiconv=$GNU_LIBICONV_RELEASE --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ \

If necessary, add the appropriate repository keys or verify the package signatures to maintain security.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
&& apk add gnu-libiconv=$GNU_LIBICONV_RELEASE --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ --allow-untrusted \
&& apk add gnu-libiconv=$GNU_LIBICONV_RELEASE --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ \

sed -i "s/xdebug.client_port\s*=\s*.*/xdebug.client_port=$XDEBUG_CLIENT_PORT/" /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
fi
if [ -n "$XDEBUG_START_WITH_REQUEST" ]; then
echo "[ xdebug ] Set xdebug.remote_autostart to $XDEBUG_START_WITH_REQUEST"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update the echo statement to match the actual XDebug parameter

The echo message refers to xdebug.remote_autostart, but the parameter being set is xdebug.start_with_request. To maintain consistency and avoid confusion, update the echo statement to reflect the correct parameter name.

Apply this diff to correct the echo statement:

- echo "[ xdebug ] Set xdebug.remote_autostart to $XDEBUG_START_WITH_REQUEST"
+ echo "[ xdebug ] Set xdebug.start_with_request to $XDEBUG_START_WITH_REQUEST"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "[ xdebug ] Set xdebug.remote_autostart to $XDEBUG_START_WITH_REQUEST"
echo "[ xdebug ] Set xdebug.start_with_request to $XDEBUG_START_WITH_REQUEST"

if [ -n "$NEW_RELIC_LICENSE_KEY" ]; then
echo '[ New Relic ] Enabled'

sed -i 's/;extension/extension/' $(php -r "echo(PHP_CONFIG_FILE_SCAN_DIR);")/newrelic.ini
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Refine the sed command to target the specific New Relic extension line

The current sed command may unintentionally uncomment other lines starting with ;extension. To precisely uncomment the New Relic extension line, refine the pattern to match newrelic.so.

Apply this diff to make the sed command more precise:

- sed -i 's/;extension/extension/' $(php -r "echo(PHP_CONFIG_FILE_SCAN_DIR);")/newrelic.ini
+ sed -i 's/^;\s*extension\s*=\s*newrelic\.so/extension=newrelic.so/' $(php -r "echo(PHP_CONFIG_FILE_SCAN_DIR);")/newrelic.ini
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sed -i 's/;extension/extension/' $(php -r "echo(PHP_CONFIG_FILE_SCAN_DIR);")/newrelic.ini
sed -i 's/^;\s*extension\s*=\s*newrelic\.so/extension=newrelic.so/' $(php -r "echo(PHP_CONFIG_FILE_SCAN_DIR);")/newrelic.ini

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
src/8.4/fpm-alpine/Dockerfile (1)

1-185: Overall assessment of the Dockerfile

The Dockerfile provides a comprehensive PHP 8.4 FPM environment with good configuration practices, but there are several critical issues that need to be addressed:

  1. Using PHP 8.4 (development version) and Xdebug beta might cause stability issues
  2. Security concerns with --allow-untrusted flag
  3. Missing New Relic version definition
  4. Unnecessary ghc package increasing image size

On the positive side:

  1. Well-structured configuration management
  2. Good security practice with XDebug disabled by default
  3. Comprehensive PHP extension setup
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b80b65f and 8ca301e.

📒 Files selected for processing (3)
  • .github/workflows/main.yaml (1 hunks)
  • src/8.4/cli-alpine/Dockerfile (1 hunks)
  • src/8.4/fpm-alpine/Dockerfile (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/8.4/cli-alpine/Dockerfile
🔇 Additional comments (7)
src/8.4/fpm-alpine/Dockerfile (7)

134-142: Good security practice: XDebug disabled by default

Excellent approach to disable XDebug by default and providing a comprehensive configuration that can be enabled when needed.


4-4: ⚠️ Potential issue

Avoid using beta versions of Xdebug in production

The Dockerfile sets XDEBUG_RELEASE to a beta version (3.4.0beta1). Using beta software in production environments can introduce instability and unexpected behavior.

Apply this diff:

-ENV XDEBUG_RELEASE=3.4.0beta1
+ENV XDEBUG_RELEASE=3.3.1  # Use the latest stable version

60-60: 🛠️ Refactor suggestion

Remove unnecessary ghc package

The Glasgow Haskell Compiler (ghc) package is not required for PHP builds and significantly increases the image size.

Apply this diff:

-        ghc \

108-108: ⚠️ Potential issue

Security risk: Remove --allow-untrusted flag

Using --allow-untrusted with apk add bypasses package signature verification, exposing the system to potential security risks.

Apply this diff:

-    && apk add gnu-libiconv=$GNU_LIBICONV_RELEASE --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ --allow-untrusted \
+    && apk add gnu-libiconv=$GNU_LIBICONV_RELEASE --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/ \

111-113: ⚠️ Potential issue

Define NEW_RELIC_AGENT_VERSION environment variable

The New Relic installation commands use an undefined environment variable NEW_RELIC_AGENT_VERSION.

Add the following line near the other ENV declarations at the top of the Dockerfile:

+ENV NEW_RELIC_AGENT_VERSION=10.11.0.3

183-183: Verify entrypoint script existence and permissions

Ensure that the hiqdev-docker-entrypoint script exists and has proper executable permissions.

✅ Verification successful

Entrypoint script exists and has correct permissions

The hiqdev-docker-entrypoint script exists in the correct location (src/8.4/fpm-alpine/) and has the proper executable permissions (-rwxr-xr-x), allowing it to be executed by all users.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the entrypoint script exists and is executable
fd -t f "hiqdev-docker-entrypoint" -x ls -l {}

Length of output: 1145


1-1: Verify PHP 8.4 base image stability

PHP 8.4 is currently in development and not yet released for production use. This might lead to stability issues.

✅ Verification successful

PHP 8.4 is released and stable

Based on the PHP releases page output, PHP 8.4.1 has been officially released as of November 21, 2024, making it a stable production version. Using PHP 8.4 as the base image is appropriate and follows good practices.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check PHP 8.4 release status and available versions
curl -s https://www.php.net/releases/index.php | grep -A 5 "8.4"

Length of output: 59682


env:
PERIODIC_UPDATES_MIN_VERSION: 7.4
PERIODIC_UPDATES_MIN_VERSION: 8.3
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Setting PERIODIC_UPDATES_MIN_VERSION to 8.3 needs reconsideration

Based on the repository structure and configuration:

  • The repository currently supports PHP versions from 7.0 to 8.4
  • MIN_SUPPORTED_VERSION is set to 7.3, meaning versions 7.0-7.2 are excluded from all builds
  • Setting PERIODIC_UPDATES_MIN_VERSION to 8.3 would stop periodic security updates for a large number of actively maintained versions (7.3-8.2)
  • This seems overly restrictive given that PHP 7.4, 8.0, 8.1, and 8.2 are still widely used in production

Recommendations:

  • Consider keeping PERIODIC_UPDATES_MIN_VERSION at a lower version (e.g., 7.4 or 8.0) to continue providing security updates for stable PHP versions
  • If the intent is to reduce maintenance burden, consider a more gradual approach by incrementing the minimum version in smaller steps
  • Document the rationale for excluding versions 7.4-8.2 from periodic updates if this change is intentional
🔗 Analysis chain

Verify the impact on older PHP versions

Increasing PERIODIC_UPDATES_MIN_VERSION from 7.4 to 8.3 means that PHP versions 7.4 through 8.2 will no longer receive periodic updates. Please confirm if this is intentional, as it might affect users relying on security updates for these versions.

Also, since this PR is working on PHP 8.4 build, why set the minimum version to 8.3 instead of 8.4?

Let's check the generate-actions.sh script and version support policy:


Note: I'm generating additional scripts to gather more context about version support policy and the rationale behind the version changes, particularly focusing on documentation and configuration files.


Note: I'm trying to understand the full context of version support by checking the available PHP versions and related configuration changes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check the generate-actions.sh script to understand version handling
cat scripts/generate-actions.sh

# Look for version support policy in documentation
fd -t f -e md -e txt . | xargs rg -i "support|version|policy"

Length of output: 1252


Script:

#!/bin/bash
# Let's check the repository's documentation and configuration files for version support information
rg -i "version|support" README.md

# Check if there are any recent changes or discussions about version support
fd -t f -e yaml -e yml . | xargs rg -i "min.*version|support.*version"

# Look for any PHP version related configurations
fd -t f composer.json | xargs cat

# Check for any version-related discussions in PR description or issue
gh pr view --json title,body

Length of output: 1823


Script:

#!/bin/bash
# Let's check what PHP versions are currently in the repository
ls -1 src/

# Check the current MIN_SUPPORTED_VERSION in the workflow
rg "MIN_SUPPORTED_VERSION:" .github/workflows/

# Look for any recent commits or changes related to version support
git log --oneline -n 10 .github/workflows/main.yaml

Length of output: 156

@SilverFire SilverFire merged commit 015bfc6 into master Nov 27, 2024
@SilverFire SilverFire deleted the 8.4 branch November 27, 2024 13:46
@coderabbitai coderabbitai Bot mentioned this pull request Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant