Skip to content

Commit d72bef9

Browse files
authored
🐳 Install PHP 8.4 + 8.5 with common extensions (#9)
1 parent c43601e commit d72bef9

2 files changed

Lines changed: 57 additions & 4 deletions

File tree

Dockerfile

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/actions/actions-runner:latest
1+
FROM ghcr.io/actions/actions-runner:2.329.0
22

33
USER root
44

@@ -44,48 +44,99 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
4444
&& apt-get clean \
4545
&& rm -rf /var/lib/apt/lists/*
4646

47-
# Add PHP repository and install PHP 8.1, 8.2, and 8.3
47+
# Add PHP repository and install PHP 8.1, 8.2, 8.3, 8.4, 8.5 and common extensions
4848
RUN add-apt-repository -y ppa:ondrej/php \
4949
&& apt-get update \
5050
&& apt-get install -y --no-install-recommends \
51+
5152
# PHP 8.1 with common extensions
5253
php8.1 \
5354
php8.1-cli \
5455
php8.1-common \
5556
php8.1-curl \
5657
php8.1-gd \
5758
php8.1-mbstring \
59+
php8.1-mysqli \
60+
php8.1-pdo-mysql \
5861
php8.1-xml \
5962
php8.1-zip \
6063
php8.1-bcmath \
64+
php8.1-opcache \
6165
php8.1-intl \
66+
6267
# PHP 8.2 with common extensions
6368
php8.2 \
6469
php8.2-cli \
6570
php8.2-common \
6671
php8.2-curl \
6772
php8.2-gd \
6873
php8.2-mbstring \
74+
php8.2-mysqli \
75+
php8.2-pdo-mysql \
6976
php8.2-xml \
7077
php8.2-zip \
7178
php8.2-bcmath \
7279
php8.2-intl \
80+
php8.2-opcache \
81+
7382
# PHP 8.3 with common extensions
7483
php8.3 \
7584
php8.3-cli \
7685
php8.3-common \
7786
php8.3-curl \
7887
php8.3-gd \
7988
php8.3-mbstring \
89+
php8.3-mysqli \
90+
php8.3-pdo-mysql \
8091
php8.3-xml \
8192
php8.3-zip \
8293
php8.3-bcmath \
8394
php8.3-intl \
95+
php8.3-opcache \
96+
97+
# PHP 8.4 with common extensions
98+
php8.4 \
99+
php8.4-cli \
100+
php8.4-common \
101+
php8.4-curl \
102+
php8.4-gd \
103+
php8.4-mbstring \
104+
php8.4-mysqli \
105+
php8.4-pdo-mysql \
106+
php8.4-xml \
107+
php8.4-zip \
108+
php8.4-bcmath \
109+
php8.4-intl \
110+
php8.4-opcache \
111+
112+
# PHP 8.5 with common extensions
113+
php8.5 \
114+
php8.5-cli \
115+
php8.5-common \
116+
php8.5-curl \
117+
php8.5-gd \
118+
php8.5-mbstring \
119+
php8.5-mysqli \
120+
php8.5-pdo-mysql \
121+
php8.5-xml \
122+
php8.5-zip \
123+
php8.5-bcmath \
124+
php8.5-intl \
84125
&& apt-get clean \
85126
&& rm -rf /var/lib/apt/lists/*
86127

87-
# Install Composer globally
88-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
128+
# Configure PHP: Register all PHP versions and set php8.5 as default
129+
RUN update-alternatives --install /usr/bin/php php /usr/bin/php8.1 81 \
130+
&& update-alternatives --install /usr/bin/php php /usr/bin/php8.2 82 \
131+
&& update-alternatives --install /usr/bin/php php /usr/bin/php8.3 83 \
132+
&& update-alternatives --install /usr/bin/php php /usr/bin/php8.4 84 \
133+
&& update-alternatives --install /usr/bin/php php /usr/bin/php8.5 85 \
134+
&& update-alternatives --set php /usr/bin/php8.5
135+
136+
# Install Composer
137+
RUN curl -sS https://getcomposer.org/installer | php -- \
138+
--install-dir=/usr/local/bin \
139+
--filename=composer \
89140
&& chmod +x /usr/local/bin/composer
90141

91142
# Install AWS CLI

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ This image comes with the following software and tools pre-installed:
1818

1919
* **Node.js 18.x**: A modern version of Node.js for JavaScript-based tools and applications.
2020
* **Python 3**: The latest stable version of Python available in the base image's repositories.
21+
* **PHP 8.1, 8.2, 8.3, 8.4,8.5**: Multiple PHP versions with common extensions pre-installed (mbstring, intl, mysqli, pdo_mysql, gd, xml, zip, curl, bcmath, opcache). PHP 8.5 is set as the default `php` command, while all versions are accessible via `php8.1`, `php8.2`, `php8.3`, `php8.4` and `php8.5`.
2122

2223
### Package Managers
2324

2425
* **npm** (via Node.js)
2526
* **yarn**: A popular JavaScript package manager.
2627
* **pip3** (via Python 3)
28+
* **Composer**: PHP dependency manager, installed globally and available system-wide.
2729

2830
### Cloud & DevOps Tools
2931

0 commit comments

Comments
 (0)