https://github.com/startxfr/docker-images-example-php
Example of a php dynamic web application to use with startx s2i builder
https://github.com/startxfr/docker-images-example-php
Last synced: 3 months ago
JSON representation
Example of a php dynamic web application to use with startx s2i builder
- Host: GitHub
- URL: https://github.com/startxfr/docker-images-example-php
- Owner: startxfr
- Created: 2018-02-18T19:41:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-21T09:13:47.000Z (11 months ago)
- Last Synced: 2025-01-06T09:44:03.557Z (5 months ago)
- Language: Shell
- Size: 6.12 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-images-example-php
Example of a dynamic web application using the startx s2i builder [startx/sv-php](https://hub.docker.com/r/startx/sv-php).
For more information on how to use this image, **[read startx php image guideline](https://github.com/startxfr/docker-images/blob/master/Services/php/README.md)**.## Running this example in OKD (aka Openshift)
### Create a sample application
```bash
# Create a openshift project
oc new-project startx-example-php
# start a new application (build and run)
oc process -f https://raw.githubusercontent.com/startxfr/docker-images/master/Services/php/openshift-template-build.yml -p APP_NAME=myapp | oc create -f -
# Watch when resources are available
sleep 30 && oc get all
```### Create a personalized application
- **Initialize** a project
```bash
export MYAPP=myapp
oc new-project ${MYAPP}
```
- **Add template** to the project service catalog
```bash
oc create -f https://raw.githubusercontent.com/startxfr/docker-images/master/Services/php/openshift-template-build.yml -n startx-example-php
```
- **Generate** your current application definition
```bash
export MYVERSION=0.1
oc process -n startx-example-php -f startx-php-build-template \
-p APP_NAME=v${MYVERSION} \
-p APP_STAGE=example \
-p BUILDER_TAG=latest \
-p SOURCE_GIT=https://github.com/startxfr/docker-images-example-php.git \
-p SOURCE_BRANCH=master \
-p MEMORY_LIMIT=256Mi \
> ./${MYAPP}.definitions.yml
```
- **Review** your resources definition stored in `./${MYAPP}.definitions.yml`
- **build and run** your application
```bash
oc create -f ./${MYAPP}.definitions.yml -n startx-example-php
sleep 15 && oc get all
```
- **Test** your application
```bash
oc describe route -n startx-example-php
curl http://
```## Running this example with source-to-image (aka s2i)
### Create a sample application
```bash
# Build the application
s2i build https://github.com/startxfr/docker-images-example-php startx/sv-php startx-php-sample
# Run the application
docker run --rm -d -p 8777:8080 startx-php-sample
# Test the sample application
curl http://localhost:8777
```### Create a personalized application
- **Initialize** a project directory
```bash
git clone https://github.com/startxfr/docker-images-example-php.git php-myapp
cd php-myapp
rm -rf .git
```
- **Develop** and create a personalized page
```bash
cat << "EOF"
EOF > index.php
```
- **Build** your current application with startx php builder
```bash
s2i build . startx/sv-php:latest startx-php-myapp
```
- **Run** your application and test it
```bash
docker run --rm -d -p 8777:8080 startx-php-myapp
```
- **Test** your application
```bash
curl http://localhost:8777
```