Debian Codegraph @

src/php/docker/README.md

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