-
Notifications
You must be signed in to change notification settings - Fork 0
🐳 Update Dockerfile to install PHP #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -44,6 +44,50 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ | |||||||||||||||||||
| && apt-get clean \ | ||||||||||||||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Add PHP repository and install PHP 8.1, 8.2, and 8.3 | ||||||||||||||||||||
| RUN add-apt-repository -y ppa:ondrej/php \ | ||||||||||||||||||||
| && apt-get update \ | ||||||||||||||||||||
| && apt-get install -y --no-install-recommends \ | ||||||||||||||||||||
| # PHP 8.1 with common extensions | ||||||||||||||||||||
| php8.1 \ | ||||||||||||||||||||
| php8.1-cli \ | ||||||||||||||||||||
| php8.1-common \ | ||||||||||||||||||||
| php8.1-curl \ | ||||||||||||||||||||
| php8.1-gd \ | ||||||||||||||||||||
| php8.1-mbstring \ | ||||||||||||||||||||
| php8.1-xml \ | ||||||||||||||||||||
| php8.1-zip \ | ||||||||||||||||||||
| php8.1-bcmath \ | ||||||||||||||||||||
| php8.1-intl \ | ||||||||||||||||||||
| # PHP 8.2 with common extensions | ||||||||||||||||||||
| php8.2 \ | ||||||||||||||||||||
| php8.2-cli \ | ||||||||||||||||||||
| php8.2-common \ | ||||||||||||||||||||
| php8.2-curl \ | ||||||||||||||||||||
| php8.2-gd \ | ||||||||||||||||||||
| php8.2-mbstring \ | ||||||||||||||||||||
| php8.2-xml \ | ||||||||||||||||||||
| php8.2-zip \ | ||||||||||||||||||||
| php8.2-bcmath \ | ||||||||||||||||||||
| php8.2-intl \ | ||||||||||||||||||||
| # PHP 8.3 with common extensions | ||||||||||||||||||||
| php8.3 \ | ||||||||||||||||||||
| php8.3-cli \ | ||||||||||||||||||||
| php8.3-common \ | ||||||||||||||||||||
| php8.3-curl \ | ||||||||||||||||||||
| php8.3-gd \ | ||||||||||||||||||||
| php8.3-mbstring \ | ||||||||||||||||||||
| php8.3-xml \ | ||||||||||||||||||||
| php8.3-zip \ | ||||||||||||||||||||
| php8.3-bcmath \ | ||||||||||||||||||||
| php8.3-intl \ | ||||||||||||||||||||
| && apt-get clean \ | ||||||||||||||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Install Composer globally | ||||||||||||||||||||
| RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ | ||||||||||||||||||||
| && chmod +x /usr/local/bin/composer | ||||||||||||||||||||
|
Comment on lines
+87
to
+89
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Use Composer's official instructions: download the installer, fetch the published SHA‑384 checksum (installer.sig) and compare it before running the installer. Commands (from Composer docs):
Official references:
[1] https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md 🌐 Web query:
💡 Result: Here are concise, practical Composer installer & dependency security best practices (2024–2025):
If you want, I can produce a short CI checklist (GitHub Actions / GitLab CI) that implements these practices. Citations:
Critical: Verify Composer installer integrity before execution. Piping the Composer installer directly from Follow Composer's official secure installation procedure: -# Install Composer globally
-RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
- && chmod +x /usr/local/bin/composer
+# Install Composer globally with integrity verification
+RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
+ && php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); exit(1); }" \
+ && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
+ && php -r "unlink('composer-setup.php');" \
+ && chmod +x /usr/local/bin/composerSee: https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md and https://composer.github.io/pubkeys.html for the published SHA-384 checksum. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| # Install AWS CLI | ||||||||||||||||||||
| RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ | ||||||||||||||||||||
| && unzip awscliv2.zip \ | ||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: brixion/github-runner
Length of output: 75
🏁 Script executed:
Repository: brixion/github-runner
Length of output: 3108
🏁 Script executed:
Repository: brixion/github-runner
Length of output: 225
🏁 Script executed:
Repository: brixion/github-runner
Length of output: 225
🏁 Script executed:
Repository: brixion/github-runner
Length of output: 47
🏁 Script executed:
# Read the README to understand the purpose cat README.mdRepository: brixion/github-runner
Length of output: 2280
🏁 Script executed:
# Check the docker-publish workflow to understand how this image is built/used cat .github/workflows/docker-publish.ymlRepository: brixion/github-runner
Length of output: 1021
🏁 Script executed:
# Check the build-check workflow cat .github/workflows/build-check.ymlRepository: brixion/github-runner
Length of output: 780
🌐 Web query:
ondrej/php PPA Ubuntu 22.04 compatibility reliability💡 Result:
Short answer: compatible and widely used, but unofficial — generally reliable if you follow the maintainer's instructions and understand the risks.
Details (summary)
Sources
[1] Launchpad — Ondřej Surý: PPA for PHP (packages & Jammy builds).
[2] deb.sury.org (sury.org / DEB.SURY.ORG) — maintainer site and install guidance.
[3] Vultr / community docs & user reports (examples of instructions and common add-apt-repository caveats).
🌐 Web query:
PHP multiple versions Ubuntu update-alternatives default💡 Result:
Short how-to
Ensure alternatives are registered (if error “no alternatives for php”): register each binary once, for example:
sudo update-alternatives --install /usr/bin/php php /usr/bin/php8.2 82
sudo update-alternatives --install /usr/bin/php php /usr/bin/php8.1 81
Repeat for phar, phar.phar, phpize, php-config as needed. [1][2]
Switch interactively:
sudo update-alternatives --config php
(and repeat for phar, phar.phar, phpize, php-config). Choose the number for the version you want. [1][2]
Or set non-interactively:
sudo update-alternatives --set php /usr/bin/php8.2
sudo update-alternatives --set phar /usr/bin/phar8.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar8.2
sudo update-alternatives --set phpize /usr/bin/phpize8.2
sudo update-alternatives --set php-config /usr/bin/php-config8.2. [1][3]
If using Apache, also switch the Apache PHP module and restart:
sudo a2dismod php8.1
sudo a2enmod php8.2
sudo systemctl restart apache2. [2][3]
Verify:
php -v
which php
Sources: Baeldung (update-alternatives for PHP) [1], StackOverflow examples (a2enmod/a2dismod + update-alternatives) [2], how-to guides (example commands for phar/phpize/php-config) [3].
🌐 Web query:
Composer installer security verification checksum💡 Result:
Short answer — verify the installer’s SHA‑384 against Composer’s published value before running it.
Commands (copy/paste):
Download installer:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
Fetch expected checksum:
HASH="$(curl -sS https://composer.github.io/installer.sig)"
Verify:
php -r "if (hash_file('SHA384','composer-setup.php') === '$HASH') { echo 'Installer verified' . PHP_EOL; } else { echo 'Installer corrupt' . PHP_EOL; unlink('composer-setup.php'); exit(1); }"
If verified, run:
php composer-setup.php --quiet
Notes:
Sources:
[1] Composer Public Keys / Checksums (installer SHA‑384).
[2] How do I install Composer programmatically? — Composer docs.
Add PHP default version configuration and secure Composer installation.
Several issues require attention:
Missing Default PHP Version: With three PHP versions installed, commands expecting
phpwill fail. Add:Insecure Composer Installation: Line 88 pipes the installer without verification. Replace with:
Documentation Gap: PHP and Composer are not mentioned in README.md despite being installed. Update documentation to reflect these additions.
Image Size Trade-off: Installing three complete PHP versions with extensions adds significant size. Consider whether all three are necessary or if a single version plus an installer (e.g., setup-php action) would be more efficient.
🤖 Prompt for AI Agents