forked from pool/nginx-image
Accepting request 1181269 from devel:BCI:Tumbleweed
🤖: sync package with devel:BCI:Tumbleweed from OBS OBS-URL: https://build.opensuse.org/request/show/1181269 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/nginx-image?expand=0&rev=12
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -14,8 +14,8 @@
|
||||
# You can contact the BCI team via https://github.com/SUSE/bci/discussions
|
||||
|
||||
|
||||
#!BuildTag: opensuse/nginx:%%nginx_version%%
|
||||
#!BuildTag: opensuse/nginx:%%nginx_version%%-%RELEASE%
|
||||
#!BuildTag: opensuse/nginx:1.27
|
||||
#!BuildTag: opensuse/nginx:1.27-%RELEASE%
|
||||
#!BuildTag: opensuse/nginx:latest
|
||||
|
||||
FROM opensuse/tumbleweed:latest
|
||||
@@ -26,22 +26,24 @@ MAINTAINER openSUSE (https://www.opensuse.org/)
|
||||
# labelprefix=org.opensuse.application.nginx
|
||||
LABEL org.opencontainers.image.title="openSUSE Tumbleweed NGINX"
|
||||
LABEL org.opencontainers.image.description="NGINX open source all-in-one load balancer, content cache and web server based on the openSUSE Tumbleweed Base Container Image."
|
||||
LABEL org.opencontainers.image.version="%%nginx_version%%"
|
||||
LABEL org.opencontainers.image.version="1.27"
|
||||
LABEL org.opencontainers.image.url="https://www.opensuse.org"
|
||||
LABEL org.opencontainers.image.created="%BUILDTIME%"
|
||||
LABEL org.opencontainers.image.vendor="openSUSE Project"
|
||||
LABEL org.opencontainers.image.source="%SOURCEURL%"
|
||||
LABEL org.opensuse.reference="registry.opensuse.org/opensuse/nginx:%%nginx_version%%-%RELEASE%"
|
||||
LABEL org.opensuse.reference="registry.opensuse.org/opensuse/nginx:1.27-%RELEASE%"
|
||||
LABEL org.openbuildservice.disturl="%DISTURL%"
|
||||
LABEL org.opensuse.lifecycle-url="https://en.opensuse.org/Lifetime"
|
||||
LABEL org.opensuse.release-stage="released"
|
||||
# endlabelprefix
|
||||
LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/nginx-image/README.md"
|
||||
|
||||
RUN set -euo pipefail; zypper -n in --no-recommends gawk nginx findutils gettext-runtime; zypper -n clean; rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2}
|
||||
RUN set -euo pipefail; zypper -n in --no-recommends gawk nginx findutils envsubst; zypper -n clean; rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2}
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
EXPOSE 80
|
||||
# sanity check that the version from the tag is equal to the version of nginx that we expect
|
||||
RUN set -euo pipefail; [ "$(rpm -q --qf '%{version}' nginx | cut -d '.' -f -2)" = "1.27" ]
|
||||
RUN set -euo pipefail; mkdir /docker-entrypoint.d
|
||||
COPY [1-3]0-*.sh /docker-entrypoint.d/
|
||||
COPY docker-entrypoint.sh /usr/local/bin
|
||||
|
88
README.md
88
README.md
@@ -1,7 +1,91 @@
|
||||
# The openSUSE Tumbleweed NGINX Container Image
|
||||
# NGINX container image
|
||||
|
||||

|
||||
|
||||
NGINX open source all-in-one load balancer, content cache and web server based on the openSUSE Tumbleweed Base Container Image.
|
||||
## Description
|
||||
|
||||
nginx (pronounced "engine-x") is an open-source reverse proxy server for the HTTP, HTTPS, SMTP, POP3, and IMAP protocols. nginx can also act as a load balancer, HTTP cache, and a web server (origin server).
|
||||
|
||||
## Usage
|
||||
|
||||
By default, the image launches nginx with the same configuration that comes with the SUSE Linux Enterprise Server.
|
||||
|
||||
```ShellSession
|
||||
$ podman run -it --rm -p 8080:80 registry.opensuse.org/opensuse/nginx:1.27
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```ShellSession
|
||||
$ podman run -it --rm -p 8080:80 -v /path/to/html/:/srv/www/htdocs/:Z registry.opensuse.org/opensuse/nginx:1.27
|
||||
```
|
||||
|
||||
**Note:** The directory `/srv/www/htdocs/` is the root directory used by the default server. Additional servers can use any other path.
|
||||
|
||||
You can access the served content on http://localhost:8080 or http://host-ip:8080.
|
||||
|
||||
## Using templates
|
||||
|
||||
By default, nginx doesn't support environment variables inside configuration blocks. This image includes a script that can extract environment variables before nginx creates configuration files.
|
||||
|
||||
The script reads `.template` files stored in `/etc/nginx/templates/` and saves the result of the [`envsubst`](https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html) command to the directory `/etc/nginx/conf.d/`.
|
||||
|
||||
For example, if you want nginx to use port 80, create a file named `/etc/nginx/templates/default.conf.template` containing the following variable definition:
|
||||
|
||||
```nginx
|
||||
listen ${NGINX_PORT};
|
||||
```
|
||||
|
||||
The template above is then rendered to `/etc/nginx/conf.d/default.conf` as follows:
|
||||
|
||||
```nginx
|
||||
listen 80;
|
||||
```
|
||||
|
||||
## Environment variables
|
||||
|
||||
### NGINX_ENTRYPOINT_QUIET_LOGS
|
||||
|
||||
This optional environment variable controls the logging during container startup. Set the value to `1` to silence logs.
|
||||
|
||||
### NGINX_ENTRYPOINT_WORKER_PROCESSES_AUTOTUNE
|
||||
|
||||
This optional environment variable enables a script to autotune the number of worker processes. Set the value to `1` to enable autotune of the worker process parameter (default is disabled).
|
||||
|
||||
### NGINX_ENVSUBST_TEMPLATE_DIR
|
||||
|
||||
This optional environment variable specifies a directory containing template files (default is `/etc/nginx/templates`).
|
||||
|
||||
**Note:** The script ignores template processing if this directory doesn't exist
|
||||
|
||||
### NGINX_ENVSUBST_OUTPUT_DIR
|
||||
|
||||
This optional environment variable specifies a directory for storing results of running [`envsubst`](https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html) on templates (default is `/etc/nginx/conf.d`).
|
||||
|
||||
The output filename is the template filename with the suffix `.template` removed.
|
||||
|
||||
**Note:** Modifying this variable also requires changing the `nginx.conf`, so it recognizes the new directory location.
|
||||
|
||||
### NGINX_ENVSUBST_TEMPLATE_SUFFIX
|
||||
|
||||
This optional environment variable changes the suffix of template files (default is `.template`).
|
||||
|
||||
**Note:** The script only processes files that have the specified suffix in their names.
|
||||
|
||||
### NGINX_ENVSUBST_FILTER
|
||||
|
||||
This optional environment variable enables filtering out variables in the template processing. Environment variables that do not match the regular expression defined by `NGINX_ENVSUBST_FILTER` are not replaced.
|
||||
|
||||
## Configuration scripts
|
||||
|
||||
To use scripts to perform configuration actions, add one or more `*.envsh` or `*.sh` scripts under `/docker-entrypoint.d/`. Any executable `*.envsh` or `*.sh` script found in the directory is executed before starting the service, which can be used to perform further configuration steps.
|
||||
|
||||
Currently, the container image ships with the following helper scripts:
|
||||
|
||||
- `20-envsubst-on-templates.sh` - Enables the use of environment variables in templates.
|
||||
- `30-tune-worker-processes.sh` - Enables autotuning the number of worker processes.
|
||||
|
||||
**Warning:** The container startup is aborted if any of the scripts exits with an error.
|
||||
|
||||
## Licensing
|
||||
|
||||
|
@@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 17 08:06:22 UTC 2024 - Alexandre Vicenzi <alexandre.vicenzi@suse.com>
|
||||
|
||||
- Extend README.md
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 10 15:11:25 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
|
Reference in New Issue
Block a user