https://github.com/zalari/docker-nginx-html5-env
NGINX enabled for HTML5 mode for SPAs and with ENV magic
https://github.com/zalari/docker-nginx-html5-env
Last synced: 11 months ago
JSON representation
NGINX enabled for HTML5 mode for SPAs and with ENV magic
- Host: GitHub
- URL: https://github.com/zalari/docker-nginx-html5-env
- Owner: zalari
- License: mit
- Created: 2019-10-28T11:01:46.000Z (over 6 years ago)
- Default Branch: develop
- Last Pushed: 2019-10-28T12:56:39.000Z (over 6 years ago)
- Last Synced: 2025-03-12T15:50:41.806Z (over 1 year ago)
- Language: Shell
- Size: 2.93 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## nginx-html5-env
This is a simple nginx image that enables html-5-mode style urls, by redirecting all request to a single file. This use case is typical for single page apps, that are doing all the routing on the client-side.
Configuration is _inspired_ by https://gist.github.com/cjus/b46a243ba610661a7efb .
Furthermore it is able to generate or merge a config.json depending on the `environment`.
## Example usage
This is image is intended to be used as a base image:
```
FROM zalari/nginx-html5-env
ENV ENV_PREFIX=ZALARI
ENV CONFIG_NAME=config.json
COPY ./app/dist /usr/share/nginx/html/
COPY config.json /usr/share/nginx/html/
```
Then all environment variables passed to the **container** (e.g. via `docker run --rm -p 80:80 -e ZALARI_test='true'
zalari/nginx-html5-env`
having the **ZALARI** prefix will be used to generate / be merged into `/usr/share/nginx/html/config.json` and should be available at
http://localhost/config.json.
There is a syntax for accessing nested values; have a look at [init/jsonenv.sh](./init/jsonenv.sh) for the actual logic for the lack of a
better documentation for the time being.