-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuildphp.sh
More file actions
executable file
·59 lines (50 loc) · 1.85 KB
/
buildphp.sh
File metadata and controls
executable file
·59 lines (50 loc) · 1.85 KB
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
#!/bin/sh
# This script builds a docker container based on AWS and compiles PHP
# Then moves the php-cgi binary out of the container before removing.
# source from https://github.com/php/php-src
if [ $# -lt 1 ]; then
echo
echo "Usage: $0 VERSION"
echo "Build shared libraries for php and its dependencies via containers"
echo
echo "Please specify the php VERSION, e.g. 7.2.0 7.1.5, 7.0.20"
echo
exit 1
fi
#Set the number of jobs while compiling, Good rule is one more than physical cores
JOBS=24
PHP_VERSION_GIT_BRANCH="php-$1"
# Set the build arguments you want to compile PHP with. remembering to keep it as small as you can
BUILD_ARGUMENTS="--enable-static=yes \
--enable-shared=no \
--enable-hash \
--enable-json \
--enable-libxml \
--enable-mbstring \
--enable-phar \
--enable-soap \
--enable-xml \
--with-curl \
--with-gd \
--with-zlib \
--with-openssl \
--without-pear \
--enable-ctype \
--enable-cgi \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-opcache \
--enable-bcmath \
--enable-exif \
--enable-zip \
--enable-opcache-file \
--with-config-file-path=/var/task/"
echo "Build PHP Binary from current branch '$PHP_VERSION_GIT_BRANCH' on https://github.com/php/php-src"
docker build --build-arg PHP_VERSION=$PHP_VERSION_GIT_BRANCH --build-arg BUILD_ARGUMENTS="$BUILD_ARGUMENTS" --build-arg JOBS=$JOBS -t php-build -f dockerfile .
container=$(docker create php-build)
docker -D cp $container:/php-src-$PHP_VERSION_GIT_BRANCH/sapi/cgi/php-cgi .
docker -D cp $container:/php-src-$PHP_VERSION_GIT_BRANCH/sapi/cli/php .
docker -D cp $container:/php-src-$PHP_VERSION_GIT_BRANCH/modules/opcache.so .
docker -D cp $container:/php-src-$PHP_VERSION_GIT_BRANCH/ext/opcache/.libs/opcache.so ./opcache2.so
docker -D cp $container:/usr/bin/ssh ./ssh
docker rm $container