|
1 |
| -# openshiftexamples-phaser-game |
2 |
| -:memo: Basic example of running a phaser app in OpenShift |
| 1 | +# OpenShift Example - Phaser Game |
| 2 | + |
| 3 | +A Phaser 3 project with ES6 support via [Babel 7](https://babeljs.io/) and [Webpack 4](https://webpack.js.org/) |
| 4 | +that includes hot-reloading for development and production-ready builds primed for OpenShift. |
| 5 | + |
| 6 | +## Available Commands |
| 7 | + |
| 8 | +| Command | Description | |
| 9 | +|---------|-------------| |
| 10 | +| `npm install` | Install project dependencies | |
| 11 | +| `npm start` | Build project and open webserver for running project locally | |
| 12 | +| `npm run build` | Builds code as a bundle for production (minification, uglification, etc..) | |
| 13 | + |
| 14 | + |
| 15 | +## Running Locally |
| 16 | +Simple, that's just this: |
| 17 | +> `npm install; npm start` |
| 18 | +
|
| 19 | +**(edit files all you want and hotdeploy will watch/update for you)** |
| 20 | + |
| 21 | + |
| 22 | +## Deploying from Local Dir to OpenShift |
| 23 | +When you run the `npm run build` command, your code will be built into a single bundle located at `dist/bundle.min.js` along with any other assets you project depends upon. |
| 24 | + |
| 25 | +Containerizing and pushing this app into your OpenShift cluster is easy with the help of [NodeShift](https://nodeshift.dev/). It will create the OpenShift configuration needed, do a build inside the cluster, then deploy the app, and expose a port into it. Just run this command |
| 26 | + >`npx nodeshift --web-app --build.env OUTPUT_DIR=dist --expose` |
| 27 | +
|
| 28 | +**(edit files and rerun `npx nodeshift` and it will update OpenShift for you)** |
| 29 | + |
| 30 | + |
| 31 | +## Deploying from GitHub to OpenShift |
| 32 | +This is also pretty easy with the help of Source 2 Image (aka s2i). Runt the following (after replacing the github URL with yours): |
| 33 | + >`oc new-app nodeshift/ubi8-s2i-web-app:latest~https://github.com/dudash/openshiftexamples-phaser-game` |
| 34 | +
|
| 35 | + |
| 36 | +## Credit & Thanks |
| 37 | +Thanks to Richard Davey @ Phaser for the [tutorial here](http://phaser.io/tutorials/retro-highscore-table) that this was initially based upon. |
0 commit comments