This is a Simple PHP apps that read a config.json file and output the content on the screen. The example is made to run as a Container that mount the config file as a volume.
- Podman or Docker to build the image
- Access to a container registry. In this case we use Quay.io
- Access to an Openshift 4.X installation
There is 2 options to retrieve the require image for this demo.
-
Build the container from a Fork or Clone of this repository and uploaded to your container registry.
Example using podman:
-
Build the image
podman build -t php-json-reader .
-
Test running the image localy.
podman run --name php-reader -d -p 8080:8080 localhost/php-json-reader
The image can now be access at http://localhost:8080
⚠️ The config file doesn't display since no volume is mounted. -
Stop the container
podman stop php-reader
-
Tag the image
podman *tag localhost/php-json-reader [YOUR_REGISTRY_URL]/php-json-reader:stable
-
Push the image
podman push [IMAGE_TAG_CREATE_BEFORE]
-
Use the image that was already build found at
quay.io/froberge/php-json-reader:stable
-
Create a new project.
oc new-project php-demo
-
Create a
new-app
. For this command we use option 2oc new-app --name php-reader --docker-image=quay.io/froberge/php-json-reader:stable --as-deployment-config=true
-
Expose the application
oc expose services/php-reader
oc create secret generic app-config --from-file=docs/config.json
oc set volume dc/php-reader --add --type=secret -m /opt/config.json --name php-json-vol --secret-name app-config --sub-path config.json