Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Update PHP docker images PHP versions (grpc#31779)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley-cheung authored Dec 7, 2022
1 parent a34f9e1 commit fa42ede
Show file tree
Hide file tree
Showing 30 changed files with 101 additions and 136 deletions.
6 changes: 3 additions & 3 deletions examples/php/echo/apache.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FROM composer:1.8.6 as composer
FROM grpc-php/base as grpc-base


FROM php:7.2-apache-stretch
FROM php:7.4-apache-buster

RUN apt-get -qq update && apt-get -qq install -y git

Expand All @@ -32,8 +32,8 @@ COPY --from=grpc-base /github/grpc/cmake/build/grpc_php_plugin \
/usr/local/bin/protoc-gen-grpc

COPY --from=grpc-base \
/usr/local/lib/php/extensions/no-debug-non-zts-20170718/grpc.so \
/usr/local/lib/php/extensions/no-debug-non-zts-20170718/grpc.so
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so \
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so


RUN docker-php-ext-enable grpc
Expand Down
2 changes: 1 addition & 1 deletion examples/php/echo/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM php:7.2-stretch
FROM php:7.4-buster

RUN apt-get -qq update && apt-get -qq install -y \
autoconf automake cmake curl git libtool \
Expand Down
6 changes: 3 additions & 3 deletions examples/php/echo/cli.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FROM composer:1.8.6 as composer
FROM grpc-php/base as grpc-base


FROM php:7.2-stretch
FROM php:7.4-buster

RUN apt-get -qq update && apt-get -qq install -y git

Expand All @@ -32,8 +32,8 @@ COPY --from=grpc-base /github/grpc/cmake/build/grpc_php_plugin \
/usr/local/bin/protoc-gen-grpc

COPY --from=grpc-base \
/usr/local/lib/php/extensions/no-debug-non-zts-20170718/grpc.so \
/usr/local/lib/php/extensions/no-debug-non-zts-20170718/grpc.so
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so \
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so


RUN docker-php-ext-enable grpc
Expand Down
6 changes: 3 additions & 3 deletions examples/php/echo/fpm.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FROM composer:1.8.6 as composer
FROM grpc-php/base as grpc-base


FROM php:7.2-fpm-stretch
FROM php:7.4-fpm-buster

RUN apt-get -qq update && apt-get -qq install -y git

Expand All @@ -32,8 +32,8 @@ COPY --from=grpc-base /github/grpc/cmake/build/grpc_php_plugin \
/usr/local/bin/protoc-gen-grpc

COPY --from=grpc-base \
/usr/local/lib/php/extensions/no-debug-non-zts-20170718/grpc.so \
/usr/local/lib/php/extensions/no-debug-non-zts-20170718/grpc.so
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so \
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so


RUN docker-php-ext-enable grpc
Expand Down
5 changes: 4 additions & 1 deletion examples/php/greeter_server.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ public function SayHello(
\Grpc\ServerContext $serverContext
): ?\Helloworld\HelloReply {
$name = $request->getName();
echo 'Received request: ' . $name . PHP_EOL;
$response = new \Helloworld\HelloReply();
$response->setMessage("Hello " . $name);
return $response;
}
}

$port = 50051;
$server = new \Grpc\RpcServer();
$server->addHttp2Port('0.0.0.0:50051');
$server->addHttp2Port('0.0.0.0:'.$port);
$server->handle(new Greeter());
echo 'Listening on port :' . $port . PHP_EOL;
$server->run();
3 changes: 2 additions & 1 deletion src/php/bin/build_all_docker_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
set -e
cd $(dirname $0)/../../..

ALL_IMAGES=( grpc-ext grpc-src alpine centos7 php-src php-future php-zts
ALL_IMAGES=( grpc-ext grpc-src alpine centos7 php-src php-zts
fork-support i386 php8 php8.2 )

if [[ "$1" == "--cmds" ]]; then
Expand All @@ -36,5 +36,6 @@ fi
set -x
for arg in "${lst[@]}"
do
echo "Building $arg..."
docker build -t grpc-php/"$arg" -f ./src/php/docker/"$arg"/Dockerfile .
done
3 changes: 2 additions & 1 deletion src/php/bin/run_all_docker_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
set -e
cd $(dirname $0)/../../..

ALL_IMAGES=( grpc-ext grpc-src alpine centos7 php-src php-future php-zts
ALL_IMAGES=( grpc-ext grpc-src alpine centos7 php-src php-zts
fork-support i386 php8 php8.2 )

if [[ "$1" == "--cmds" ]]; then
Expand All @@ -36,5 +36,6 @@ fi
set -x
for arg in "${lst[@]}"
do
echo "Running $arg..."
docker run -it --rm grpc-php/"$arg"
done
6 changes: 4 additions & 2 deletions src/php/docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM php:7.2-alpine3.9
FROM php:7.4-alpine3.15

RUN apk add autoconf g++ make zlib-dev git bash wget linux-headers

Expand All @@ -34,4 +34,6 @@ RUN pear package && \
find . -name grpc-*.tgz | xargs -I{} pecl install {}


CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests"]
CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", \
"--ignore-valgrind-undef-errors"]

8 changes: 5 additions & 3 deletions src/php/docker/centos7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ SHELL [ "/usr/bin/scl", "enable", "devtoolset-7"]
RUN yum install epel-release -y && \
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && \
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm && \
yum --enablerepo=remi-php72 install php -y && \
yum-config-manager --enable remi-php72 > /dev/null && \
yum --enablerepo=remi-php74 install php -y && \
yum-config-manager --enable remi-php74 > /dev/null && \
yum install -y make wget which \
gmp-devel libmpc-devel mpfr-devel yum-utils \
php-devel php-fpm php-pear && \
Expand All @@ -48,4 +48,6 @@ RUN pear package && \
find . -name grpc-*.tgz | xargs -I{} pecl install {}


CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests"]
CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", \
"--ignore-valgrind-undef-errors"]

10 changes: 8 additions & 2 deletions src/php/docker/grpc-ext/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM php:7.2-stretch
FROM php:7.4-buster

RUN apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq install -y \
autoconf automake git libtool pkg-config \
Expand All @@ -36,4 +36,10 @@ RUN pear package && \
find . -name grpc-*.tgz | xargs -I{} pecl install {}


CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests"]
RUN curl -sS https://getcomposer.org/installer | php && \
chmod +x composer.phar && \
mv composer.phar /usr/local/bin/composer

CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", \
"--ignore-valgrind-undef-errors"]

4 changes: 2 additions & 2 deletions src/php/docker/grpc-src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM php:7.2-stretch
FROM php:7.4-buster

RUN apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq install -y \
autoconf automake git libtool pkg-config \
Expand Down Expand Up @@ -43,4 +43,4 @@ RUN phpize && \
make install


CMD ["/github/grpc/src/php/bin/run_tests.sh"]
CMD ["/github/grpc/src/php/bin/run_tests.sh", "--ignore-valgrind-undef-errors"]
6 changes: 4 additions & 2 deletions src/php/docker/i386/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM i386/php:7.2
FROM i386/php:7.4

RUN apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq install -y \
autoconf automake git libtool pkg-config \
Expand All @@ -36,4 +36,6 @@ RUN pear package && \
find . -name grpc-*.tgz | xargs -I{} pecl install {}


CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", "--ignore-valgrind-undef-errors"]
CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", \
"--ignore-valgrind-undef-errors"]

39 changes: 0 additions & 39 deletions src/php/docker/php-future/Dockerfile

This file was deleted.

24 changes: 10 additions & 14 deletions src/php/docker/php-src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM debian:stretch
FROM debian:buster

RUN apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq install -y \
autoconf build-essential git libtool \
libcurl4-openssl-dev libedit-dev libsodium-dev \
libssl-dev libxml2-dev \
pkg-config valgrind wget zlib1g-dev
autoconf bison build-essential git libtool \
libcurl4-openssl-dev libedit-dev libonig-dev libsodium-dev \
libsqlite3-dev libssl-dev libxml2-dev \
pkg-config re2c valgrind wget zlib1g-dev


WORKDIR /tmp
Expand All @@ -28,25 +28,19 @@ RUN wget https://phar.phpunit.de/phpunit-8.5.13.phar && \
chmod +x /usr/local/bin/phpunit


RUN wget http://ftp.gnu.org/gnu/bison/bison-3.4.2.tar.gz && \
tar -zxvf bison-3.4.2.tar.gz && \
cd bison-3.4.2 && \
./configure && make && make install


WORKDIR /github/php-src

ARG MAKEFLAGS=-j8

RUN git clone https://github.com/php/php-src .

RUN git checkout php-7.2.22 && \
RUN git checkout php-7.4.33 && \
./buildconf --force && \
./configure --build=x86_64-linux-gnu --enable-option-checking=fatal \
--enable-debug --enable-pcntl \
--enable-ftp --enable-mbstring --enable-mysqlnd \
--with-curl --with-libedit --with-mhash --with-openssl \
--with-sodium=shared --with-zlib && \
--with-pear --with-sodium=shared --with-zlib && \
make && make install


Expand All @@ -58,4 +52,6 @@ RUN pear package && \
find . -name grpc-*.tgz | xargs -I{} pecl install {}


CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests"]
CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", \
"--ignore-valgrind-undef-errors"]

6 changes: 4 additions & 2 deletions src/php/docker/php-zts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM php:7.2-zts-stretch
FROM php:7.4-zts-buster

RUN apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq install -y \
autoconf automake git libtool pkg-config \
Expand All @@ -36,4 +36,6 @@ RUN pear package && \
find . -name grpc-*.tgz | xargs -I{} pecl install {}


CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests"]
CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", \
"--ignore-valgrind-undef-errors"]

12 changes: 4 additions & 8 deletions src/php/docker/php8.2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM php:8.2.0RC4-zts-buster
FROM php:8.2.0RC7-zts-buster

RUN apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq install -y \
autoconf automake git libtool pkg-config \
Expand All @@ -23,12 +23,6 @@ ARG MAKEFLAGS=-j8

WORKDIR /tmp

# install pear
RUN apt-get install expect -y && \
curl -LO http://pear.php.net/go-pear.phar && \
expect -c 'spawn php ./go-pear.phar; expect "or Enter to continue:"; send "\n"; expect "Currently used php.ini"; send "\n"; expect eof' && \
rm go-pear.phar

RUN wget https://phar.phpunit.de/phpunit-9.5.9.phar && \
mv phpunit-9.5.9.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit
Expand All @@ -42,4 +36,6 @@ RUN pear package && \
find . -name grpc-*.tgz | xargs -I{} pecl install {}


CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", "--ignore-valgrind-undef-errors"]
CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", \
"--ignore-valgrind-undef-errors"]

16 changes: 6 additions & 10 deletions src/php/docker/php8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM php:8.0.0-zts-buster
FROM php:8.1-buster

RUN apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq install -y \
autoconf automake git libtool pkg-config \
Expand All @@ -23,14 +23,8 @@ ARG MAKEFLAGS=-j8

WORKDIR /tmp

# install pear
RUN apt-get install expect -y && \
curl -LO http://pear.php.net/go-pear.phar && \
expect -c 'spawn php ./go-pear.phar; expect "or Enter to continue:"; send "\n"; expect "Currently used php.ini"; send "\n"; expect eof' && \
rm go-pear.phar

RUN wget https://phar.phpunit.de/phpunit-8.5.13.phar && \
mv phpunit-8.5.13.phar /usr/local/bin/phpunit && \
RUN wget https://phar.phpunit.de/phpunit-9.5.9.phar && \
mv phpunit-9.5.9.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit


Expand All @@ -42,4 +36,6 @@ RUN pear package && \
find . -name grpc-*.tgz | xargs -I{} pecl install {}


CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", "--ignore-valgrind-undef-errors"]
CMD ["/github/grpc/src/php/bin/run_tests.sh", "--skip-persistent-channel-tests", \
"--ignore-valgrind-undef-errors"]

4 changes: 2 additions & 2 deletions templates/examples/php/echo/copy_from_grpc_base.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ COPY --from=grpc-base /github/grpc/cmake/build/grpc_php_plugin ${'\\'}
/usr/local/bin/protoc-gen-grpc

COPY --from=grpc-base ${'\\'}
/usr/local/lib/php/extensions/no-debug-non-zts-20170718/grpc.so ${'\\'}
/usr/local/lib/php/extensions/no-debug-non-zts-20170718/grpc.so
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so ${'\\'}
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so
Loading

0 comments on commit fa42ede

Please sign in to comment.