File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed
serving/samples/helloworld-php Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -2,5 +2,7 @@ FROM php:7.2.6-apache
22
33COPY index.php /var/www/html/
44
5- # Run on port 8080 rather than 80
6- RUN sed -i 's/80/8080/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
5+ ENV PORT 8080
6+
7+ # Use the PORT environment variable in Apache configuration files.
8+ RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
Original file line number Diff line number Diff line change @@ -29,9 +29,8 @@ following instructions recreate the source files from this folder.
2929
3030 ` ` ` php
3131 < ? php
32- $target = getenv(' TARGET' , true) ? : " World" ;
33- echo sprintf(" Hello %s!\n" , $target );
34- ? >
32+ $target = getenv(' TARGET' , true) ? : " World" ;
33+ echo sprintf(" Hello %s!\n" , $target );
3534 ` ` `
3635
37361. Create a file named ` Dockerfile` and copy the code block below into it.
@@ -42,8 +41,10 @@ following instructions recreate the source files from this folder.
4241
4342 COPY index.php /var/www/html/
4443
45- # Run on port 8080 rather than 80
46- RUN sed -i ' s/80/8080/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
44+ ENV PORT 8080
45+
46+ RUN sed -i ' s/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
47+
4748 ` ` `
4849
49501. Create a new file, ` service.yaml` and copy the following service definition
Original file line number Diff line number Diff line change 11<?php
2- $ target = getenv ('TARGET ' , true ) ?: "World " ;
3- echo sprintf ("Hello %s! \n" , $ target );
4- ?>
2+ $ target = getenv ('TARGET ' , true ) ?: 'World ' ;
3+ echo sprintf ('Hello %s!\n ' , $ target );
You can’t perform that action at this time.
0 commit comments