serving/samples/helloworld-php: simplify and standardize Dockerfile (#504)

This commit is contained in:
Adam Ross 2018-11-19 16:29:25 -08:00 committed by Knative Prow Robot
parent 772040a3f6
commit 61189dc968
2 changed files with 14 additions and 4 deletions

View File

@ -1,8 +1,13 @@
# Use the official PHP 7.2 image.
# https://hub.docker.com/_/php
FROM php:7.2.6-apache
# Copy local code to the container image.
COPY index.php /var/www/html/
ENV PORT 8080
# Use the PORT environment variable in Apache configuration files.
RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
# Configure and document the service HTTP port.
ENV PORT 8080
EXPOSE $PORT

View File

@ -37,14 +37,19 @@ following instructions recreate the source files from this folder.
See [official PHP docker image](https://hub.docker.com/_/php/) for more details.
```docker
# Use the official PHP 7.2 image.
# https://hub.docker.com/_/php
FROM php:7.2.6-apache
# Copy local code to the container image.
COPY index.php /var/www/html/
ENV PORT 8080
# Use the PORT environment variable in Apache configuration files.
RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
# Configure and document the service HTTP port.
ENV PORT 8080
EXPOSE $PORT
```
1. Create a new file, `service.yaml` and copy the following service definition