• Home
Name Date Size #Lines LOC

..--

alpine/12-May-2024-3825

centos7/12-May-2024-5237

fork-support/12-May-2024-6434

grpc-ext/12-May-2024-4027

grpc-src/12-May-2024-4731

i386/12-May-2024-4027

php-future/12-May-2024-4027

php-src/12-May-2024-6243

php-zts/12-May-2024-4027

php5/12-May-2024-4027

php8/12-May-2024-4632

README.mdD12-May-20244.1 KiB182139

README.md

1
2# Docker Images for Testing
3
4This directory contains a number of docker images to assist testing the
5[gRPC PECL extension](http://pecl.php.net/package/grpc) against various
6different PHP environments.
7
8
9## Build and Run Tests
10```sh
11$ cd grpc
12```
13
14To build all docker images:
15```sh
16$ ./src/php/bin/build_all_docker_images.sh
17```
18
19Or to only build some selected images
20```sh
21$ ./src/php/bin/build_all_docker_images.sh grpc-ext php-src
22```
23
24Or to only print out individual `docker build` commands
25```sh
26$ ./src/php/bin/build_all_docker_images.sh --cmds
27```
28
29To run all tests:
30```sh
31$ ./src/php/bin/run_all_docker_images.sh
32```
33
34Or to only run some selected images
35```sh
36$ ./src/php/bin/run_all_docker_images.sh grpc-ext php-src
37```
38
39Or to only print out individual `docker run` commands
40```sh
41$ ./src/php/bin/run_all_docker_images.sh --cmds
42```
43
44## Build and Run Specified Image
45### `grpc-ext`
46This image builds the full `grpc` PECL extension (effectively the current
47release candidate), installs it against the current PHP version, and runs the
48unit tests.
49
50Build `grpc-ext` docker image:
51```sh
52$ cd grpc
53$ docker build -t grpc-php/grpc-ext -f ./src/php/docker/grpc-ext/Dockerfile .
54```
55
56Run image:
57```sh
58$ docker run -it --rm grpc-php/grpc-ext
59```
60
61### `grpc-src`
62
63This image builds the `grpc` PECL extension in a 'thin' way, only containing
64the gRPC extension source files. The gRPC C Core library is expected to be
65installed separately and dynamically linked. The extension is installed
66against the current PHP version.
67
68This also allows us to compile our `grpc` extension with some additional
69configure options, like `--enable-tests`, which allows some additional unit
70tests to be run.
71
72Build `grpc-src` docker image:
73```sh
74$ cd grpc
75$ docker build -t grpc-php/grpc-src -f ./src/php/docker/grpc-src/Dockerfile .
76```
77
78Run image:
79```sh
80$ docker run -it --rm grpc-php/grpc-src
81```
82
83### `alpine`
84
85This image builds the `grpc` extension against the current PHP version in an
86Alpine-Linux base image.
87
88Build `alpine` docker image:
89```sh
90$ cd grpc
91$ docker build -t grpc-php/alpine -f ./src/php/docker/alpine/Dockerfile .
92```
93
94Run image:
95```sh
96$ docker run -it --rm grpc-php/alpine
97```
98### `centos7`
99
100This image builds the `grpc` extension against the GCC version in Centos7 base image. The default version of gcc in centos7 is gcc-4.8.5. Run `scl enable devtoolset-7 bash` command to enable gcc-7.3.1.
101
102Build `centos7` docker image:
103```sh
104$ cd grpc
105$ docker build -t grpc-gcc7/centos -f ./src/php/docker/centos7/Dockerfile .
106```
107
108Run image:
109```sh
110$ docker run -it --rm grpc-gcc7/centos
111```
112
113### `php-src`
114
115Instead of using a general purpose base docker image provided by PHP, here we
116compile PHP itself from
117[source](https://github.com/php/php-src). This will allow us to change some
118`configure` options, like `--enable-debug`. Then we proceed to build the full
119`grpc` PECL extension and run the unit tests.
120
121Build `php-src` docker image:
122```sh
123$ cd grpc
124$ docker build -t grpc-php/php-src -f ./src/php/docker/php-src/Dockerfile .
125```
126
127Run image:
128```sh
129$ docker run -it --rm grpc-php/php-src
130```
131
132### `php-zts`
133
134This image builds the `grpc` extension against the current PHP version with ZTS
135enabled.
136
137Build `php-zts` docker image:
138```sh
139$ cd grpc
140$ docker build -t grpc-php/php-zts -f ./src/php/docker/php-zts/Dockerfile .
141```
142
143Run image:
144```sh
145$ docker run -it --rm grpc-php/php-zts
146```
147
148### `php-future`
149
150This image builds the `grpc` extension against the next future PHP version
151currently in alpha, beta or release candidate stage.
152
153Build `php-future` docker image:
154```sh
155$ cd grpc
156$ docker build -t grpc-php/php-future -f ./src/php/docker/php-future/Dockerfile .
157```
158
159Run image:
160```sh
161$ docker run -it --rm grpc-php/php-future
162```
163### `php5`
164
165NOTE: PHP 5.x has reached the end-of-life state and is no longer supported.
166
167
168### `fork-support`
169
170This image tests `pcntl_fork()` support and makes sure scripts using
171`pcntl_fork()` don't hang or crash.
172
173Build `grpc-ext` docker image:
174```sh
175$ cd grpc
176$ docker build -t grpc-php/fork-support -f ./src/php/docker/fork-support/Dockerfile .
177```
178
179Run image:
180```sh
181$ docker run -it --rm grpc-php/fork-support
182```