Skip to content

Commit

Permalink
Added a command in the startup script to make sure the logging folder…
Browse files Browse the repository at this point in the history
… exist (ref: knative/serving#3809)
  • Loading branch information
mreferre committed Feb 29, 2020
1 parent f661909 commit fab9a76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
By default this custom `NGINX` docker image behave like a regular stock NGINX image. However, it can be customized in a couple of ways:
By default this custom `NGINX` docker image behave like a regular stock NGINX image. However, it also supports a few customizations if and when needed.

The customizations supported are:

- if the `INDEX_HTML_CONTENT` system variable is passed to the container, the image will replace the `index.html` file with the content of the variable
- if the `HTTP_PORT` system variable is passed to the container, the image will configure the `/etc/nginx/conf.d/default.conf` to listen on the port specified in the variable
Expand All @@ -17,4 +19,4 @@ The command below runs a stock nginx image replacing the default `index.html` fi
docker run --rm -d -e INDEX_HTML_CONTENT="My custom web site" -e HTTP_PORT=8080 -p 8080:8080 mreferre/nginx-custom-site:latest
```

The two variables can be used independently.
The variables can be used independently.
5 changes: 4 additions & 1 deletion startup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
#!/bin/bash
# this is a list of all variables supported
if [ "${INDEX_HTML_CONTENT}" ]; then echo $INDEX_HTML_CONTENT > /usr/share/nginx/html/index.html; fi
if [ "${HTTP_PORT}" ]; then sed -i "s/listen 80/listen ${HTTP_PORT}/g" /etc/nginx/conf.d/default.conf; fi
# the following is required in some rare circumstances where a volume is mounted at /var/log (ref: https://github.com/knative/serving/issues/3809)
mkdir -p /var/log/nginx
# this starts the nginx service
nginx -g "daemon off;"

0 comments on commit fab9a76

Please sign in to comment.