-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile.template
116 lines (101 loc) · 3.67 KB
/
Dockerfile.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# vim:set ft=dockerfile:
# Do not edit individual Dockerfiles manually. Instead, please make changes to the Dockerfile.template, which will be used by the build script to generate Dockerfiles.
# By policy, the base image tag should be a quarterly tag unless there's a
# specific reason to use a different one. This means January, April, July, or
# October.
##### NOTE: PHP Versions < 8.1 need use Ubuntu 20.04 due OpenSSL/libssl. Please adjust accordingly #####
FROM cimg/%%PARENT%%:2024.02
LABEL maintainer="CircleCI Execution Team <[email protected]>"
ENV PHP_VERSION=%%VERSION_FULL%%
ENV PHP_MINOR=%%VERSION_MINOR%%
# Install dependencies
RUN sudo apt-get update && sudo apt-get install -y \
autoconf \
bison \
build-essential \
libcurl4-openssl-dev \
libfreetype6-dev \
libjpeg-dev \
libonig-dev \
libpng-dev \
libreadline-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libtool \
libwebp-dev \
libxml2-dev \
libxpm-dev \
libzip-dev \
re2c \
zlib1g-dev \
&& \
sudo rm -rf /var/lib/apt/lists/* && \
curl -sSL "https://github.com/php/php-src/archive/refs/tags/php-${PHP_VERSION}.tar.gz" | tar -xz && \
cd "php-src-php-${PHP_VERSION}" && \
./buildconf --force && \
./configure \
--enable-bcmath \
--enable-fpm \
--enable-gd \
--enable-intl \
--enable-mbstring \
--enable-pcntl \
--enable-phpdbg \
--enable-sockets \
--enable-calendar \
--enable-ftp \
--enable-exif \
--enable-zip \
--enable-soap \
--with-config-file-scan-dir=/etc/php.d \
--with-curl \
--with-freetype \
--with-jpeg \
--with-mysqli=mysqlnd \
--with-pear \
--with-pdo-mysql=mysqlnd \
--with-pdo-pgsql \
--with-pdo-sqlite \
--with-pgsql \
--with-openssl \
--with-readline \
--with-sodium \
--with-webp \
--with-xpm \
--with-zip \
--with-zlib \
&& \
make -j $(nproc) && \
sudo make install && \
cd .. && \
rm -r php-src-php-${PHP_VERSION} && \
sudo mkdir -p /etc/php.d && \
echo 'memory_limit = -1' | sudo tee -a /etc/php.d/circleci.ini && \
sudo pear config-set php_ini /etc/php.d/circleci.ini && \
sudo pecl update-channels && \
# Check things are as they should be
# We likely don't need to test EVERYTHING here. What is important is to
# test for extensions where the installation method has changed between
# releases. For example, if we decide to use this template back for older
# PHP releases, the way `gd` is enabled at compile time changed.
php --version | grep "${PHP_VERSION}" || ( echo "Error: PHP version installed is not correct." && exit 1 ) && \
php -m | grep "gd" && \
php -m | grep "sockets"
# Installs install-php-extensions functionality to add, enable, and configurae PHP extensions. The script is modified to
# work with CircleCI's environment. Updates to the script should be accompanied with a release in it's respective
# repositpory
ENV EXT_URL=https://github.com/CircleCI-Public/docker-php-extension-installer/releases/latest/download/install-php-extensions
ENV PHP_INI_DIR=/usr/local/etc/php
COPY /docker-php-scripts/docker-php-* /usr/local/bin/
RUN sudo mkdir -p "$PHP_INI_DIR/conf.d" && \
curl -sSL ${EXT_URL} > install-php-extensions && \
sudo mv install-php-extensions /usr/local/bin && \
sudo chmod +x /usr/local/bin/docker-php-* /usr/local/bin/install-php-extensions
# Install the PHP package manager Composer
ENV COMPOSER_VERSION=2.7.7
RUN sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
sudo php composer-setup.php --version=$COMPOSER_VERSION --install-dir=/usr/local/bin --filename=composer && \
sudo php -r "unlink('composer-setup.php');" && \
composer --version
ENV PATH /home/circleci/.config/composer/vendor/bin:/home/circleci/.composer/vendor/bin:$PATH