[info=7fbf8ff41f8da50b87b3210cbe3e5aa461b9fb32]
OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/nginx-image?expand=0&rev=223
This commit is contained in:
commit
8fa8998a78
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
78
20-envsubst-on-templates.sh
Normal file
78
20-envsubst-on-templates.sh
Normal file
@ -0,0 +1,78 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ME=$(basename "$0")
|
||||
|
||||
entrypoint_log() {
|
||||
if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
add_stream_block() {
|
||||
local conffile="/etc/nginx/nginx.conf"
|
||||
|
||||
if grep -q -E "\s*stream\s*\{" "$conffile"; then
|
||||
entrypoint_log "$ME: $conffile contains a stream block; include $stream_output_dir/*.conf to enable stream templates"
|
||||
else
|
||||
# check if the file can be modified, e.g. not on a r/o filesystem
|
||||
touch "$conffile" 2>/dev/null || { entrypoint_log "$ME: info: can not modify $conffile (read-only file system?)"; exit 0; }
|
||||
entrypoint_log "$ME: Appending stream block to $conffile to include $stream_output_dir/*.conf"
|
||||
cat << END >> "$conffile"
|
||||
# added by "$ME" on "$(date)"
|
||||
stream {
|
||||
include $stream_output_dir/*.conf;
|
||||
}
|
||||
END
|
||||
fi
|
||||
}
|
||||
|
||||
auto_envsubst() {
|
||||
local template_dir="${NGINX_ENVSUBST_TEMPLATE_DIR:-/etc/nginx/templates}"
|
||||
local suffix="${NGINX_ENVSUBST_TEMPLATE_SUFFIX:-.template}"
|
||||
local output_dir="${NGINX_ENVSUBST_OUTPUT_DIR:-/etc/nginx/conf.d}"
|
||||
local stream_suffix="${NGINX_ENVSUBST_STREAM_TEMPLATE_SUFFIX:-.stream-template}"
|
||||
local stream_output_dir="${NGINX_ENVSUBST_STREAM_OUTPUT_DIR:-/etc/nginx/stream-conf.d}"
|
||||
local filter="${NGINX_ENVSUBST_FILTER:-}"
|
||||
|
||||
local template defined_envs relative_path output_path subdir
|
||||
defined_envs=$(printf '${%s} ' $(awk "END { for (name in ENVIRON) { print ( name ~ /${filter}/ ) ? name : \"\" } }" < /dev/null ))
|
||||
[ -d "$template_dir" ] || return 0
|
||||
if [ ! -w "$output_dir" ]; then
|
||||
entrypoint_log "$ME: ERROR: $template_dir exists, but $output_dir is not writable"
|
||||
return 0
|
||||
fi
|
||||
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
|
||||
relative_path="${template#"$template_dir/"}"
|
||||
output_path="$output_dir/${relative_path%"$suffix"}"
|
||||
subdir=$(dirname "$relative_path")
|
||||
# create a subdirectory where the template file exists
|
||||
mkdir -p "$output_dir/$subdir"
|
||||
entrypoint_log "$ME: Running envsubst on $template to $output_path"
|
||||
envsubst "$defined_envs" < "$template" > "$output_path"
|
||||
done
|
||||
|
||||
# Print the first file with the stream suffix, this will be false if there are none
|
||||
if test -n "$(find "$template_dir" -name "*$stream_suffix" -print -quit)"; then
|
||||
mkdir -p "$stream_output_dir"
|
||||
if [ ! -w "$stream_output_dir" ]; then
|
||||
entrypoint_log "$ME: ERROR: $template_dir exists, but $stream_output_dir is not writable"
|
||||
return 0
|
||||
fi
|
||||
add_stream_block
|
||||
find "$template_dir" -follow -type f -name "*$stream_suffix" -print | while read -r template; do
|
||||
relative_path="${template#"$template_dir/"}"
|
||||
output_path="$stream_output_dir/${relative_path%"$stream_suffix"}"
|
||||
subdir=$(dirname "$relative_path")
|
||||
# create a subdirectory where the template file exists
|
||||
mkdir -p "$stream_output_dir/$subdir"
|
||||
entrypoint_log "$ME: Running envsubst on $template to $output_path"
|
||||
envsubst "$defined_envs" < "$template" > "$output_path"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
auto_envsubst
|
||||
|
||||
exit 0
|
188
30-tune-worker-processes.sh
Normal file
188
30-tune-worker-processes.sh
Normal file
@ -0,0 +1,188 @@
|
||||
#!/bin/sh
|
||||
# vim:sw=2:ts=2:sts=2:et
|
||||
|
||||
set -eu
|
||||
|
||||
LC_ALL=C
|
||||
ME=$(basename "$0")
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
[ "${NGINX_ENTRYPOINT_WORKER_PROCESSES_AUTOTUNE:-}" ] || exit 0
|
||||
|
||||
touch /etc/nginx/nginx.conf 2>/dev/null || { echo >&2 "$ME: error: can not modify /etc/nginx/nginx.conf (read-only file system?)"; exit 0; }
|
||||
|
||||
ceildiv() {
|
||||
num=$1
|
||||
div=$2
|
||||
echo $(( (num + div - 1) / div ))
|
||||
}
|
||||
|
||||
get_cpuset() {
|
||||
cpusetroot=$1
|
||||
cpusetfile=$2
|
||||
ncpu=0
|
||||
[ -f "$cpusetroot/$cpusetfile" ] || return 1
|
||||
for token in $( tr ',' ' ' < "$cpusetroot/$cpusetfile" ); do
|
||||
case "$token" in
|
||||
*-*)
|
||||
count=$( seq $(echo "$token" | tr '-' ' ') | wc -l )
|
||||
ncpu=$(( ncpu+count ))
|
||||
;;
|
||||
*)
|
||||
ncpu=$(( ncpu+1 ))
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "$ncpu"
|
||||
}
|
||||
|
||||
get_quota() {
|
||||
cpuroot=$1
|
||||
ncpu=0
|
||||
[ -f "$cpuroot/cpu.cfs_quota_us" ] || return 1
|
||||
[ -f "$cpuroot/cpu.cfs_period_us" ] || return 1
|
||||
cfs_quota=$( cat "$cpuroot/cpu.cfs_quota_us" )
|
||||
cfs_period=$( cat "$cpuroot/cpu.cfs_period_us" )
|
||||
[ "$cfs_quota" = "-1" ] && return 1
|
||||
[ "$cfs_period" = "0" ] && return 1
|
||||
ncpu=$( ceildiv "$cfs_quota" "$cfs_period" )
|
||||
[ "$ncpu" -gt 0 ] || return 1
|
||||
echo "$ncpu"
|
||||
}
|
||||
|
||||
get_quota_v2() {
|
||||
cpuroot=$1
|
||||
ncpu=0
|
||||
[ -f "$cpuroot/cpu.max" ] || return 1
|
||||
cfs_quota=$( cut -d' ' -f 1 < "$cpuroot/cpu.max" )
|
||||
cfs_period=$( cut -d' ' -f 2 < "$cpuroot/cpu.max" )
|
||||
[ "$cfs_quota" = "max" ] && return 1
|
||||
[ "$cfs_period" = "0" ] && return 1
|
||||
ncpu=$( ceildiv "$cfs_quota" "$cfs_period" )
|
||||
[ "$ncpu" -gt 0 ] || return 1
|
||||
echo "$ncpu"
|
||||
}
|
||||
|
||||
get_cgroup_v1_path() {
|
||||
needle=$1
|
||||
found=
|
||||
foundroot=
|
||||
mountpoint=
|
||||
|
||||
[ -r "/proc/self/mountinfo" ] || return 1
|
||||
[ -r "/proc/self/cgroup" ] || return 1
|
||||
|
||||
while IFS= read -r line; do
|
||||
case "$needle" in
|
||||
"cpuset")
|
||||
case "$line" in
|
||||
*cpuset*)
|
||||
found=$( echo "$line" | cut -d ' ' -f 4,5 )
|
||||
break
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"cpu")
|
||||
case "$line" in
|
||||
*cpuset*)
|
||||
;;
|
||||
*cpu,cpuacct*|*cpuacct,cpu|*cpuacct*|*cpu*)
|
||||
found=$( echo "$line" | cut -d ' ' -f 4,5 )
|
||||
break
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
done << __EOF__
|
||||
$( grep -F -- '- cgroup ' /proc/self/mountinfo )
|
||||
__EOF__
|
||||
|
||||
while IFS= read -r line; do
|
||||
controller=$( echo "$line" | cut -d: -f 2 )
|
||||
case "$needle" in
|
||||
"cpuset")
|
||||
case "$controller" in
|
||||
cpuset)
|
||||
mountpoint=$( echo "$line" | cut -d: -f 3 )
|
||||
break
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"cpu")
|
||||
case "$controller" in
|
||||
cpu,cpuacct|cpuacct,cpu|cpuacct|cpu)
|
||||
mountpoint=$( echo "$line" | cut -d: -f 3 )
|
||||
break
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done << __EOF__
|
||||
$( grep -F -- 'cpu' /proc/self/cgroup )
|
||||
__EOF__
|
||||
|
||||
case "${found%% *}" in
|
||||
"/")
|
||||
foundroot="${found##* }$mountpoint"
|
||||
;;
|
||||
"$mountpoint")
|
||||
foundroot="${found##* }"
|
||||
;;
|
||||
esac
|
||||
echo "$foundroot"
|
||||
}
|
||||
|
||||
get_cgroup_v2_path() {
|
||||
found=
|
||||
foundroot=
|
||||
mountpoint=
|
||||
|
||||
[ -r "/proc/self/mountinfo" ] || return 1
|
||||
[ -r "/proc/self/cgroup" ] || return 1
|
||||
|
||||
while IFS= read -r line; do
|
||||
found=$( echo "$line" | cut -d ' ' -f 4,5 )
|
||||
done << __EOF__
|
||||
$( grep -F -- '- cgroup2 ' /proc/self/mountinfo )
|
||||
__EOF__
|
||||
|
||||
while IFS= read -r line; do
|
||||
mountpoint=$( echo "$line" | cut -d: -f 3 )
|
||||
done << __EOF__
|
||||
$( grep -F -- '0::' /proc/self/cgroup )
|
||||
__EOF__
|
||||
|
||||
case "${found%% *}" in
|
||||
"")
|
||||
return 1
|
||||
;;
|
||||
"/")
|
||||
foundroot="${found##* }$mountpoint"
|
||||
;;
|
||||
"$mountpoint" | /../*)
|
||||
foundroot="${found##* }"
|
||||
;;
|
||||
esac
|
||||
echo "$foundroot"
|
||||
}
|
||||
|
||||
ncpu_online=$( getconf _NPROCESSORS_ONLN )
|
||||
ncpu_cpuset=
|
||||
ncpu_quota=
|
||||
ncpu_cpuset_v2=
|
||||
ncpu_quota_v2=
|
||||
|
||||
cpuset=$( get_cgroup_v1_path "cpuset" ) && ncpu_cpuset=$( get_cpuset "$cpuset" "cpuset.effective_cpus" ) || ncpu_cpuset=$ncpu_online
|
||||
cpu=$( get_cgroup_v1_path "cpu" ) && ncpu_quota=$( get_quota "$cpu" ) || ncpu_quota=$ncpu_online
|
||||
cgroup_v2=$( get_cgroup_v2_path ) && ncpu_cpuset_v2=$( get_cpuset "$cgroup_v2" "cpuset.cpus.effective" ) || ncpu_cpuset_v2=$ncpu_online
|
||||
cgroup_v2=$( get_cgroup_v2_path ) && ncpu_quota_v2=$( get_quota_v2 "$cgroup_v2" ) || ncpu_quota_v2=$ncpu_online
|
||||
|
||||
ncpu=$( printf "%s\n%s\n%s\n%s\n%s\n" \
|
||||
"$ncpu_online" \
|
||||
"$ncpu_cpuset" \
|
||||
"$ncpu_quota" \
|
||||
"$ncpu_cpuset_v2" \
|
||||
"$ncpu_quota_v2" \
|
||||
| sort -n \
|
||||
| head -n 1 )
|
||||
|
||||
sed -i.bak -r 's/^(worker_processes)(.*)$/# Commented out by '"$ME"' on '"$(date)"'\n#\1\2\n\1 '"$ncpu"';/' /etc/nginx/nginx.conf
|
59
Dockerfile
Normal file
59
Dockerfile
Normal file
@ -0,0 +1,59 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon.
|
||||
|
||||
# The content of THIS FILE IS AUTOGENERATED and should not be manually modified.
|
||||
# It is maintained by the BCI team and generated by
|
||||
# https://github.com/SUSE/BCI-dockerfile-generator
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
# You can contact the BCI team via https://github.com/SUSE/bci/discussions
|
||||
|
||||
#!UseOBSRepositories
|
||||
|
||||
#!BuildTag: opensuse/nginx:1.27-%RELEASE%
|
||||
#!BuildTag: opensuse/nginx:1.27
|
||||
#!BuildTag: opensuse/nginx:latest
|
||||
|
||||
FROM opensuse/tumbleweed:latest
|
||||
|
||||
RUN set -euo pipefail; \
|
||||
zypper -n install --no-recommends gawk nginx findutils envsubst; \
|
||||
zypper -n clean; \
|
||||
rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}
|
||||
|
||||
# Define labels according to https://en.opensuse.org/Building_derived_containers
|
||||
# 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="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.opencontainers.image.ref.name="1.27-%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#openSUSE_BCI"
|
||||
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"
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
EXPOSE 80/tcp
|
||||
# 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
|
||||
COPY index.html /srv/www/htdocs/
|
||||
RUN set -euo pipefail; chmod +x /docker-entrypoint.d/*.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN set -euo pipefail; install -d -o nginx -g nginx -m 750 /var/log/nginx; ln -sf /dev/stdout /var/log/nginx/access.log; ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
|
||||
STOPSIGNAL SIGQUIT
|
23
LICENSE
Normal file
23
LICENSE
Normal file
@ -0,0 +1,23 @@
|
||||
Copyright (C) 2011-2023 F5, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
98
README.md
Normal file
98
README.md
Normal file
@ -0,0 +1,98 @@
|
||||
# NGINX 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
|
||||
|
||||
`SPDX-License-Identifier: MIT`
|
||||
|
||||
This documentation and the build recipe are licensed as MIT.
|
||||
The container itself contains various software components under various open source licenses listed in the associated
|
||||
Software Bill of Materials (SBOM).
|
||||
|
||||
This image is based on [openSUSE Tumbleweed](https://get.opensuse.org/tumbleweed/).
|
5
_scmsync.obsinfo
Normal file
5
_scmsync.obsinfo
Normal file
@ -0,0 +1,5 @@
|
||||
mtime: 1735740828
|
||||
commit: 8720cff6b7dc48da6eab529ec066581a09603659
|
||||
url: https://github.com/SUSE/bci-dockerfile-generator
|
||||
revision: Tumbleweed
|
||||
subdir: nginx-image
|
10
_service
Normal file
10
_service
Normal file
@ -0,0 +1,10 @@
|
||||
<services>
|
||||
<service mode="buildtime" name="docker_label_helper"/>
|
||||
<service mode="buildtime" name="kiwi_metainfo_helper"/>
|
||||
<service mode="buildtime" name="replace_using_package_version">
|
||||
<param name="file">Dockerfile</param>
|
||||
<param name="regex">%%nginx_version%%</param>
|
||||
<param name="package">nginx</param>
|
||||
<param name="parse-version">minor</param>
|
||||
</service>
|
||||
</services>
|
47
docker-entrypoint.sh
Normal file
47
docker-entrypoint.sh
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
# vim:sw=4:ts=4:et
|
||||
|
||||
set -e
|
||||
|
||||
entrypoint_log() {
|
||||
if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" = "nginx" ] || [ "$1" = "nginx-debug" ]; then
|
||||
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
|
||||
entrypoint_log "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
|
||||
|
||||
entrypoint_log "$0: Looking for shell scripts in /docker-entrypoint.d/"
|
||||
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
|
||||
case "$f" in
|
||||
*.envsh)
|
||||
if [ -x "$f" ]; then
|
||||
entrypoint_log "$0: Sourcing $f";
|
||||
. "$f"
|
||||
else
|
||||
# warn on shell scripts without exec bit
|
||||
entrypoint_log "$0: Ignoring $f, not executable";
|
||||
fi
|
||||
;;
|
||||
*.sh)
|
||||
if [ -x "$f" ]; then
|
||||
entrypoint_log "$0: Launching $f";
|
||||
"$f"
|
||||
else
|
||||
# warn on shell scripts without exec bit
|
||||
entrypoint_log "$0: Ignoring $f, not executable";
|
||||
fi
|
||||
;;
|
||||
*) entrypoint_log "$0: Ignoring $f";;
|
||||
esac
|
||||
done
|
||||
|
||||
entrypoint_log "$0: Configuration complete; ready for start up"
|
||||
else
|
||||
entrypoint_log "$0: No files found in /docker-entrypoint.d/, skipping configuration"
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "$@"
|
18
index.html
Normal file
18
index.html
Normal file
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome to nginx!</title>
|
||||
<style>
|
||||
body {
|
||||
width: 35em;
|
||||
margin: 0 auto;
|
||||
font-family: Tahoma, Verdana, Arial, sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to nginx!</h1>
|
||||
<p>If you see this page, the container with the nginx web server is
|
||||
successfully installed and working.</p>
|
||||
</body>
|
||||
</html>
|
144
nginx-image.changes
Normal file
144
nginx-image.changes
Normal file
@ -0,0 +1,144 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 1 14:13:48 UTC 2025 - SUSE Update Bot <bci-internal@suse.de>
|
||||
|
||||
- update copyright year
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 3 13:26:37 UTC 2024 - SUSE Update Bot <bci-internal@suse.de>
|
||||
|
||||
- Change attribute order in _service
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 25 11:56:16 UTC 2024 - SUSE Update Bot <bci-internal@suse.de>
|
||||
|
||||
- Add line breaks into package version check
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 30 18:28:27 UTC 2024 - SUSE Update Bot <bci-internal@suse.de>
|
||||
|
||||
- be explicit in protocol for expose statement
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 30 15:34:45 UTC 2024 - SUSE Update Bot <bci-internal@suse.de>
|
||||
|
||||
- remove nonsensical org.opencontainers.image.authors - duplication of .vendor
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 11 15:12:52 UTC 2024 - SUSE Update Bot <bci-internal@suse.de>
|
||||
|
||||
- make the tag with -%RELEASE% the first tag listed
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 25 17:36:16 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- rerender installation step in multiple lines, allow uninstalling optional packages
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 25 17:12:11 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- improved log cleaning
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 12 10:37:22 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- set useobsrepositories explicitly
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 14 12:30:32 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- install packages first
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 8 19:28:10 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- add oci.image.ref.name
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 8 16:43:43 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- remove oci reference annotation again
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 5 11:38:13 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- add OCI reference annotation
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Aug 3 08:56:51 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- set OCI.authors attribute instead of deprecated MAINTAINER
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 31 12:06:44 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- set specific lifecycle url for openSUSE BCI
|
||||
|
||||
-------------------------------------------------------------------
|
||||
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>
|
||||
|
||||
- update README; reduce unnecessary newlines
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 5 15:13:27 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- Don't add artifacthub labels into labelprefix section
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 4 12:35:15 UTC 2024 - Alexandre Vicenzi <alexandre.vicenzi@suse.com>
|
||||
|
||||
- Fix grammar mistake in licensing footer
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon May 27 17:31:22 UTC 2024 - Alexandre Vicenzi <alexandre.vicenzi@suse.com>
|
||||
|
||||
- Remove broken 10-listen-on-ipv6-by-default.sh and install gettext-runtime for envsubst
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 16 16:20:25 UTC 2024 - Dan Čermák <dcermak@suse.com>
|
||||
|
||||
- install findutils for the containers that need it explicitly
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue May 7 19:07:24 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- extend READMEs; correct eula for application images
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 12 12:03:53 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- Don't wipe everything in /var/log, only remove log files (this omits directories owned by packages)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 17 14:29:14 UTC 2024 - Dan Čermák <dcermak@suse.com>
|
||||
|
||||
- Add initial README stub
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 2 08:26:58 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- update year to 2024
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 28 14:29:10 UTC 2023 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- add copyright and description header
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 7 08:16:03 UTC 2023 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- refresh entrypoint scripts from upstream
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 24 12:54:31 UTC 2023 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- Fix base image naming in description label
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Jul 23 09:35:12 UTC 2023 - SUSE Update Bot <bci-internal@suse.de>
|
||||
|
||||
- First version of the NGINX BCI
|
Loading…
x
Reference in New Issue
Block a user