From 914af51cd9d1bb37deb6e49ee5070280d9f3f103 Mon Sep 17 00:00:00 2001
From: Konstantin Pavlov <thresh@videolan.org>
Date: Fri, 4 Nov 2022 19:22:04 +0400
Subject: [PATCH] Regenerated after last commits.

---
 .../10-listen-on-ipv6-by-default.sh           |  67 -------
 .../alpine-perl/20-envsubst-on-templates.sh   |  39 ----
 .../alpine-perl/30-tune-worker-processes.sh   | 188 ------------------
 mainline/alpine-perl/Dockerfile               |  58 +-----
 mainline/alpine-perl/docker-entrypoint.sh     |  47 -----
 .../alpine/10-listen-on-ipv6-by-default.sh    |  67 -------
 mainline/alpine/20-envsubst-on-templates.sh   |  39 ----
 mainline/alpine/30-tune-worker-processes.sh   | 188 ------------------
 mainline/alpine/Dockerfile                    |  51 +----
 mainline/alpine/docker-entrypoint.sh          |  47 -----
 .../10-listen-on-ipv6-by-default.sh           |  67 -------
 .../debian-perl/20-envsubst-on-templates.sh   |  39 ----
 .../debian-perl/30-tune-worker-processes.sh   | 188 ------------------
 mainline/debian-perl/Dockerfile               |  34 +---
 mainline/debian-perl/docker-entrypoint.sh     |  47 -----
 .../10-listen-on-ipv6-by-default.sh           |  67 -------
 .../alpine-perl/20-envsubst-on-templates.sh   |  39 ----
 .../alpine-perl/30-tune-worker-processes.sh   | 188 ------------------
 stable/alpine-perl/Dockerfile                 |  58 +-----
 stable/alpine-perl/docker-entrypoint.sh       |  47 -----
 stable/alpine/10-listen-on-ipv6-by-default.sh |  67 -------
 stable/alpine/20-envsubst-on-templates.sh     |  39 ----
 stable/alpine/30-tune-worker-processes.sh     | 188 ------------------
 stable/alpine/Dockerfile                      |  51 +----
 stable/alpine/docker-entrypoint.sh            |  47 -----
 .../10-listen-on-ipv6-by-default.sh           |  67 -------
 .../debian-perl/20-envsubst-on-templates.sh   |  39 ----
 .../debian-perl/30-tune-worker-processes.sh   | 188 ------------------
 stable/debian-perl/Dockerfile                 |  34 +---
 stable/debian-perl/docker-entrypoint.sh       |  47 -----
 30 files changed, 20 insertions(+), 2312 deletions(-)
 delete mode 100755 mainline/alpine-perl/10-listen-on-ipv6-by-default.sh
 delete mode 100755 mainline/alpine-perl/20-envsubst-on-templates.sh
 delete mode 100755 mainline/alpine-perl/30-tune-worker-processes.sh
 delete mode 100755 mainline/alpine-perl/docker-entrypoint.sh
 delete mode 100755 mainline/alpine/10-listen-on-ipv6-by-default.sh
 delete mode 100755 mainline/alpine/20-envsubst-on-templates.sh
 delete mode 100755 mainline/alpine/30-tune-worker-processes.sh
 delete mode 100755 mainline/alpine/docker-entrypoint.sh
 delete mode 100755 mainline/debian-perl/10-listen-on-ipv6-by-default.sh
 delete mode 100755 mainline/debian-perl/20-envsubst-on-templates.sh
 delete mode 100755 mainline/debian-perl/30-tune-worker-processes.sh
 delete mode 100755 mainline/debian-perl/docker-entrypoint.sh
 delete mode 100755 stable/alpine-perl/10-listen-on-ipv6-by-default.sh
 delete mode 100755 stable/alpine-perl/20-envsubst-on-templates.sh
 delete mode 100755 stable/alpine-perl/30-tune-worker-processes.sh
 delete mode 100755 stable/alpine-perl/docker-entrypoint.sh
 delete mode 100755 stable/alpine/10-listen-on-ipv6-by-default.sh
 delete mode 100755 stable/alpine/20-envsubst-on-templates.sh
 delete mode 100755 stable/alpine/30-tune-worker-processes.sh
 delete mode 100755 stable/alpine/docker-entrypoint.sh
 delete mode 100755 stable/debian-perl/10-listen-on-ipv6-by-default.sh
 delete mode 100755 stable/debian-perl/20-envsubst-on-templates.sh
 delete mode 100755 stable/debian-perl/30-tune-worker-processes.sh
 delete mode 100755 stable/debian-perl/docker-entrypoint.sh

diff --git a/mainline/alpine-perl/10-listen-on-ipv6-by-default.sh b/mainline/alpine-perl/10-listen-on-ipv6-by-default.sh
deleted file mode 100755
index b265586..0000000
--- a/mainline/alpine-perl/10-listen-on-ipv6-by-default.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-ME=$(basename $0)
-DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
-
-# check if we have ipv6 available
-if [ ! -f "/proc/net/if_inet6" ]; then
-    entrypoint_log "$ME: info: ipv6 not available"
-    exit 0
-fi
-
-if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
-    entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE is not a file or does not exist"
-    exit 0
-fi
-
-# check if the file can be modified, e.g. not on a r/o filesystem
-touch /$DEFAULT_CONF_FILE 2>/dev/null || { entrypoint_log "$ME: info: can not modify /$DEFAULT_CONF_FILE (read-only file system?)"; exit 0; }
-
-# check if the file is already modified, e.g. on a container restart
-grep -q "listen  \[::]\:80;" /$DEFAULT_CONF_FILE && { entrypoint_log "$ME: info: IPv6 listen already enabled"; exit 0; }
-
-if [ -f "/etc/os-release" ]; then
-    . /etc/os-release
-else
-    entrypoint_log "$ME: info: can not guess the operating system"
-    exit 0
-fi
-
-entrypoint_log "$ME: info: Getting the checksum of /$DEFAULT_CONF_FILE"
-
-case "$ID" in
-    "debian")
-        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    "alpine")
-        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    *)
-        entrypoint_log "$ME: info: Unsupported distribution"
-        exit 0
-        ;;
-esac
-
-# enable ipv6 on default.conf listen sockets
-sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
-
-entrypoint_log "$ME: info: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
-
-exit 0
diff --git a/mainline/alpine-perl/20-envsubst-on-templates.sh b/mainline/alpine-perl/20-envsubst-on-templates.sh
deleted file mode 100755
index d0398b1..0000000
--- a/mainline/alpine-perl/20-envsubst-on-templates.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-set -e
-
-ME=$(basename $0)
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    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 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
-}
-
-auto_envsubst
-
-exit 0
diff --git a/mainline/alpine-perl/30-tune-worker-processes.sh b/mainline/alpine-perl/30-tune-worker-processes.sh
deleted file mode 100755
index 9aa42e9..0000000
--- a/mainline/alpine-perl/30-tune-worker-processes.sh
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/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
diff --git a/mainline/alpine-perl/Dockerfile b/mainline/alpine-perl/Dockerfile
index 7564b46..d0e13e4 100644
--- a/mainline/alpine-perl/Dockerfile
+++ b/mainline/alpine-perl/Dockerfile
@@ -3,18 +3,9 @@
 #
 # PLEASE DO NOT EDIT IT DIRECTLY.
 #
-FROM alpine:3.17
-
-LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-
-ENV NGINX_VERSION 1.23.2
-ENV NJS_VERSION   0.7.7
-ENV PKG_RELEASE   1
+FROM nginx:1.23.2-alpine
 
 RUN set -x \
-# create nginx user/group first, to be consistent throughout docker variants
-    && addgroup -g 101 -S nginx \
-    && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \
     && apkArch="$(cat /etc/apk/arch)" \
     && nginxPackages=" \
         nginx=${NGINX_VERSION}-r${PKG_RELEASE} \
@@ -56,11 +47,7 @@ RUN set -x \
                 pcre2-dev \
                 zlib-dev \
                 linux-headers \
-                libxslt-dev \
-                gd-dev \
-                geoip-dev \
                 perl-dev \
-                libedit-dev \
                 bash \
                 alpine-sdk \
                 findutils \
@@ -78,7 +65,7 @@ RUN set -x \
                 && tar xzvf ${NGINX_VERSION}-${PKG_RELEASE}.tar.gz \
                 && cd pkg-oss-${NGINX_VERSION}-${PKG_RELEASE} \
                 && cd alpine \
-                && make all \
+                && make module-perl \
                 && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \
                 && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \
                 " \
@@ -92,43 +79,4 @@ RUN set -x \
 # if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
     && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \
     && if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \
-    && if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \
-# Bring in gettext so we can get `envsubst`, then throw
-# the rest away. To do this, we need to install `gettext`
-# then move `envsubst` out of the way so `gettext` can
-# be deleted completely, then move `envsubst` back.
-    && apk add --no-cache --virtual .gettext gettext \
-    && mv /usr/bin/envsubst /tmp/ \
-    \
-    && runDeps="$( \
-        scanelf --needed --nobanner /tmp/envsubst \
-            | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
-            | sort -u \
-            | xargs -r apk info --installed \
-            | sort -u \
-    )" \
-    && apk add --no-cache $runDeps \
-    && apk del .gettext \
-    && mv /tmp/envsubst /usr/local/bin/ \
-# Bring in tzdata so users could set the timezones through the environment
-# variables
-    && apk add --no-cache tzdata \
-# Bring in curl and ca-certificates to make registering on DNS SD easier
-    && apk add --no-cache curl ca-certificates \
-# forward request and error logs to docker log collector
-    && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log \
-# create a docker-entrypoint.d directory
-    && mkdir /docker-entrypoint.d
-
-COPY docker-entrypoint.sh /
-COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
-COPY 20-envsubst-on-templates.sh /docker-entrypoint.d
-COPY 30-tune-worker-processes.sh /docker-entrypoint.d
-ENTRYPOINT ["/docker-entrypoint.sh"]
-
-EXPOSE 80
-
-STOPSIGNAL SIGQUIT
-
-CMD ["nginx", "-g", "daemon off;"]
+    && if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi
diff --git a/mainline/alpine-perl/docker-entrypoint.sh b/mainline/alpine-perl/docker-entrypoint.sh
deleted file mode 100755
index e201fe6..0000000
--- a/mainline/alpine-perl/docker-entrypoint.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-if [ "$1" = "nginx" -o "$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 "$@"
diff --git a/mainline/alpine/10-listen-on-ipv6-by-default.sh b/mainline/alpine/10-listen-on-ipv6-by-default.sh
deleted file mode 100755
index b265586..0000000
--- a/mainline/alpine/10-listen-on-ipv6-by-default.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-ME=$(basename $0)
-DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
-
-# check if we have ipv6 available
-if [ ! -f "/proc/net/if_inet6" ]; then
-    entrypoint_log "$ME: info: ipv6 not available"
-    exit 0
-fi
-
-if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
-    entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE is not a file or does not exist"
-    exit 0
-fi
-
-# check if the file can be modified, e.g. not on a r/o filesystem
-touch /$DEFAULT_CONF_FILE 2>/dev/null || { entrypoint_log "$ME: info: can not modify /$DEFAULT_CONF_FILE (read-only file system?)"; exit 0; }
-
-# check if the file is already modified, e.g. on a container restart
-grep -q "listen  \[::]\:80;" /$DEFAULT_CONF_FILE && { entrypoint_log "$ME: info: IPv6 listen already enabled"; exit 0; }
-
-if [ -f "/etc/os-release" ]; then
-    . /etc/os-release
-else
-    entrypoint_log "$ME: info: can not guess the operating system"
-    exit 0
-fi
-
-entrypoint_log "$ME: info: Getting the checksum of /$DEFAULT_CONF_FILE"
-
-case "$ID" in
-    "debian")
-        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    "alpine")
-        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    *)
-        entrypoint_log "$ME: info: Unsupported distribution"
-        exit 0
-        ;;
-esac
-
-# enable ipv6 on default.conf listen sockets
-sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
-
-entrypoint_log "$ME: info: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
-
-exit 0
diff --git a/mainline/alpine/20-envsubst-on-templates.sh b/mainline/alpine/20-envsubst-on-templates.sh
deleted file mode 100755
index d0398b1..0000000
--- a/mainline/alpine/20-envsubst-on-templates.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-set -e
-
-ME=$(basename $0)
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    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 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
-}
-
-auto_envsubst
-
-exit 0
diff --git a/mainline/alpine/30-tune-worker-processes.sh b/mainline/alpine/30-tune-worker-processes.sh
deleted file mode 100755
index 9aa42e9..0000000
--- a/mainline/alpine/30-tune-worker-processes.sh
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/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
diff --git a/mainline/alpine/Dockerfile b/mainline/alpine/Dockerfile
index b81c2e2..c6550eb 100644
--- a/mainline/alpine/Dockerfile
+++ b/mainline/alpine/Dockerfile
@@ -3,18 +3,11 @@
 #
 # PLEASE DO NOT EDIT IT DIRECTLY.
 #
-FROM alpine:3.17
+FROM nginx:1.23.2-alpine-slim
 
-LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-
-ENV NGINX_VERSION 1.23.2
 ENV NJS_VERSION   0.7.7
-ENV PKG_RELEASE   1
 
 RUN set -x \
-# create nginx user/group first, to be consistent throughout docker variants
-    && addgroup -g 101 -S nginx \
-    && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \
     && apkArch="$(cat /etc/apk/arch)" \
     && nginxPackages=" \
         nginx=${NGINX_VERSION}-r${PKG_RELEASE} \
@@ -58,7 +51,6 @@ RUN set -x \
                 libxslt-dev \
                 gd-dev \
                 geoip-dev \
-                perl-dev \
                 libedit-dev \
                 bash \
                 alpine-sdk \
@@ -77,7 +69,7 @@ RUN set -x \
                 && tar xzvf ${NGINX_VERSION}-${PKG_RELEASE}.tar.gz \
                 && cd pkg-oss-${NGINX_VERSION}-${PKG_RELEASE} \
                 && cd alpine \
-                && make all \
+                && make module-geoip module-image-filter module-njs module-xslt \
                 && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \
                 && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \
                 " \
@@ -92,42 +84,5 @@ RUN set -x \
     && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \
     && if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \
     && if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \
-# Bring in gettext so we can get `envsubst`, then throw
-# the rest away. To do this, we need to install `gettext`
-# then move `envsubst` out of the way so `gettext` can
-# be deleted completely, then move `envsubst` back.
-    && apk add --no-cache --virtual .gettext gettext \
-    && mv /usr/bin/envsubst /tmp/ \
-    \
-    && runDeps="$( \
-        scanelf --needed --nobanner /tmp/envsubst \
-            | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
-            | sort -u \
-            | xargs -r apk info --installed \
-            | sort -u \
-    )" \
-    && apk add --no-cache $runDeps \
-    && apk del .gettext \
-    && mv /tmp/envsubst /usr/local/bin/ \
-# Bring in tzdata so users could set the timezones through the environment
-# variables
-    && apk add --no-cache tzdata \
 # Bring in curl and ca-certificates to make registering on DNS SD easier
-    && apk add --no-cache curl ca-certificates \
-# forward request and error logs to docker log collector
-    && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log \
-# create a docker-entrypoint.d directory
-    && mkdir /docker-entrypoint.d
-
-COPY docker-entrypoint.sh /
-COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
-COPY 20-envsubst-on-templates.sh /docker-entrypoint.d
-COPY 30-tune-worker-processes.sh /docker-entrypoint.d
-ENTRYPOINT ["/docker-entrypoint.sh"]
-
-EXPOSE 80
-
-STOPSIGNAL SIGQUIT
-
-CMD ["nginx", "-g", "daemon off;"]
+    && apk add --no-cache curl ca-certificates
diff --git a/mainline/alpine/docker-entrypoint.sh b/mainline/alpine/docker-entrypoint.sh
deleted file mode 100755
index e201fe6..0000000
--- a/mainline/alpine/docker-entrypoint.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-if [ "$1" = "nginx" -o "$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 "$@"
diff --git a/mainline/debian-perl/10-listen-on-ipv6-by-default.sh b/mainline/debian-perl/10-listen-on-ipv6-by-default.sh
deleted file mode 100755
index b265586..0000000
--- a/mainline/debian-perl/10-listen-on-ipv6-by-default.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-ME=$(basename $0)
-DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
-
-# check if we have ipv6 available
-if [ ! -f "/proc/net/if_inet6" ]; then
-    entrypoint_log "$ME: info: ipv6 not available"
-    exit 0
-fi
-
-if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
-    entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE is not a file or does not exist"
-    exit 0
-fi
-
-# check if the file can be modified, e.g. not on a r/o filesystem
-touch /$DEFAULT_CONF_FILE 2>/dev/null || { entrypoint_log "$ME: info: can not modify /$DEFAULT_CONF_FILE (read-only file system?)"; exit 0; }
-
-# check if the file is already modified, e.g. on a container restart
-grep -q "listen  \[::]\:80;" /$DEFAULT_CONF_FILE && { entrypoint_log "$ME: info: IPv6 listen already enabled"; exit 0; }
-
-if [ -f "/etc/os-release" ]; then
-    . /etc/os-release
-else
-    entrypoint_log "$ME: info: can not guess the operating system"
-    exit 0
-fi
-
-entrypoint_log "$ME: info: Getting the checksum of /$DEFAULT_CONF_FILE"
-
-case "$ID" in
-    "debian")
-        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    "alpine")
-        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    *)
-        entrypoint_log "$ME: info: Unsupported distribution"
-        exit 0
-        ;;
-esac
-
-# enable ipv6 on default.conf listen sockets
-sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
-
-entrypoint_log "$ME: info: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
-
-exit 0
diff --git a/mainline/debian-perl/20-envsubst-on-templates.sh b/mainline/debian-perl/20-envsubst-on-templates.sh
deleted file mode 100755
index d0398b1..0000000
--- a/mainline/debian-perl/20-envsubst-on-templates.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-set -e
-
-ME=$(basename $0)
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    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 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
-}
-
-auto_envsubst
-
-exit 0
diff --git a/mainline/debian-perl/30-tune-worker-processes.sh b/mainline/debian-perl/30-tune-worker-processes.sh
deleted file mode 100755
index 9aa42e9..0000000
--- a/mainline/debian-perl/30-tune-worker-processes.sh
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/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
diff --git a/mainline/debian-perl/Dockerfile b/mainline/debian-perl/Dockerfile
index 913ee5f..92896b7 100644
--- a/mainline/debian-perl/Dockerfile
+++ b/mainline/debian-perl/Dockerfile
@@ -3,18 +3,9 @@
 #
 # PLEASE DO NOT EDIT IT DIRECTLY.
 #
-FROM debian:bullseye-slim
-
-LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-
-ENV NGINX_VERSION   1.23.2
-ENV NJS_VERSION     0.7.7
-ENV PKG_RELEASE     1~bullseye
+FROM nginx:1.23.2
 
 RUN set -x \
-# create nginx user/group first, to be consistent throughout docker variants
-    && addgroup --system --gid 101 nginx \
-    && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx \
     && apt-get update \
     && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
     && \
@@ -59,11 +50,11 @@ RUN set -x \
             \
 # build .deb files from upstream's source packages (which are verified by apt-get)
             && apt-get update \
-            && apt-get build-dep -y $nginxPackages \
+            && apt-get build-dep -y nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} \
             && ( \
                 cd "$tempDir" \
                 && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
-                    apt-get source --compile $nginxPackages \
+                    apt-get source --compile nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} \
             ) \
 # we don't remove APT lists here because they get re-downloaded and removed later
             \
@@ -95,21 +86,4 @@ RUN set -x \
     && if [ -n "$tempDir" ]; then \
         apt-get purge -y --auto-remove \
         && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
-    fi \
-# forward request and error logs to docker log collector
-    && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log \
-# create a docker-entrypoint.d directory
-    && mkdir /docker-entrypoint.d
-
-COPY docker-entrypoint.sh /
-COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
-COPY 20-envsubst-on-templates.sh /docker-entrypoint.d
-COPY 30-tune-worker-processes.sh /docker-entrypoint.d
-ENTRYPOINT ["/docker-entrypoint.sh"]
-
-EXPOSE 80
-
-STOPSIGNAL SIGQUIT
-
-CMD ["nginx", "-g", "daemon off;"]
+    fi
diff --git a/mainline/debian-perl/docker-entrypoint.sh b/mainline/debian-perl/docker-entrypoint.sh
deleted file mode 100755
index e201fe6..0000000
--- a/mainline/debian-perl/docker-entrypoint.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-if [ "$1" = "nginx" -o "$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 "$@"
diff --git a/stable/alpine-perl/10-listen-on-ipv6-by-default.sh b/stable/alpine-perl/10-listen-on-ipv6-by-default.sh
deleted file mode 100755
index b265586..0000000
--- a/stable/alpine-perl/10-listen-on-ipv6-by-default.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-ME=$(basename $0)
-DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
-
-# check if we have ipv6 available
-if [ ! -f "/proc/net/if_inet6" ]; then
-    entrypoint_log "$ME: info: ipv6 not available"
-    exit 0
-fi
-
-if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
-    entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE is not a file or does not exist"
-    exit 0
-fi
-
-# check if the file can be modified, e.g. not on a r/o filesystem
-touch /$DEFAULT_CONF_FILE 2>/dev/null || { entrypoint_log "$ME: info: can not modify /$DEFAULT_CONF_FILE (read-only file system?)"; exit 0; }
-
-# check if the file is already modified, e.g. on a container restart
-grep -q "listen  \[::]\:80;" /$DEFAULT_CONF_FILE && { entrypoint_log "$ME: info: IPv6 listen already enabled"; exit 0; }
-
-if [ -f "/etc/os-release" ]; then
-    . /etc/os-release
-else
-    entrypoint_log "$ME: info: can not guess the operating system"
-    exit 0
-fi
-
-entrypoint_log "$ME: info: Getting the checksum of /$DEFAULT_CONF_FILE"
-
-case "$ID" in
-    "debian")
-        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    "alpine")
-        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    *)
-        entrypoint_log "$ME: info: Unsupported distribution"
-        exit 0
-        ;;
-esac
-
-# enable ipv6 on default.conf listen sockets
-sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
-
-entrypoint_log "$ME: info: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
-
-exit 0
diff --git a/stable/alpine-perl/20-envsubst-on-templates.sh b/stable/alpine-perl/20-envsubst-on-templates.sh
deleted file mode 100755
index d0398b1..0000000
--- a/stable/alpine-perl/20-envsubst-on-templates.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-set -e
-
-ME=$(basename $0)
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    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 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
-}
-
-auto_envsubst
-
-exit 0
diff --git a/stable/alpine-perl/30-tune-worker-processes.sh b/stable/alpine-perl/30-tune-worker-processes.sh
deleted file mode 100755
index 9aa42e9..0000000
--- a/stable/alpine-perl/30-tune-worker-processes.sh
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/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
diff --git a/stable/alpine-perl/Dockerfile b/stable/alpine-perl/Dockerfile
index b7118ba..b1320e9 100644
--- a/stable/alpine-perl/Dockerfile
+++ b/stable/alpine-perl/Dockerfile
@@ -3,18 +3,9 @@
 #
 # PLEASE DO NOT EDIT IT DIRECTLY.
 #
-FROM alpine:3.17
-
-LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-
-ENV NGINX_VERSION 1.22.1
-ENV NJS_VERSION   0.7.7
-ENV PKG_RELEASE   1
+FROM nginx:1.22.1-alpine
 
 RUN set -x \
-# create nginx user/group first, to be consistent throughout docker variants
-    && addgroup -g 101 -S nginx \
-    && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \
     && apkArch="$(cat /etc/apk/arch)" \
     && nginxPackages=" \
         nginx=${NGINX_VERSION}-r${PKG_RELEASE} \
@@ -56,11 +47,7 @@ RUN set -x \
                 pcre2-dev \
                 zlib-dev \
                 linux-headers \
-                libxslt-dev \
-                gd-dev \
-                geoip-dev \
                 perl-dev \
-                libedit-dev \
                 bash \
                 alpine-sdk \
                 findutils \
@@ -78,7 +65,7 @@ RUN set -x \
                 && tar xzvf ${NGINX_VERSION}-${PKG_RELEASE}.tar.gz \
                 && cd pkg-oss-${NGINX_VERSION}-${PKG_RELEASE} \
                 && cd alpine \
-                && make all \
+                && make module-perl \
                 && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \
                 && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \
                 " \
@@ -92,43 +79,4 @@ RUN set -x \
 # if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
     && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \
     && if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \
-    && if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \
-# Bring in gettext so we can get `envsubst`, then throw
-# the rest away. To do this, we need to install `gettext`
-# then move `envsubst` out of the way so `gettext` can
-# be deleted completely, then move `envsubst` back.
-    && apk add --no-cache --virtual .gettext gettext \
-    && mv /usr/bin/envsubst /tmp/ \
-    \
-    && runDeps="$( \
-        scanelf --needed --nobanner /tmp/envsubst \
-            | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
-            | sort -u \
-            | xargs -r apk info --installed \
-            | sort -u \
-    )" \
-    && apk add --no-cache $runDeps \
-    && apk del .gettext \
-    && mv /tmp/envsubst /usr/local/bin/ \
-# Bring in tzdata so users could set the timezones through the environment
-# variables
-    && apk add --no-cache tzdata \
-# Bring in curl and ca-certificates to make registering on DNS SD easier
-    && apk add --no-cache curl ca-certificates \
-# forward request and error logs to docker log collector
-    && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log \
-# create a docker-entrypoint.d directory
-    && mkdir /docker-entrypoint.d
-
-COPY docker-entrypoint.sh /
-COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
-COPY 20-envsubst-on-templates.sh /docker-entrypoint.d
-COPY 30-tune-worker-processes.sh /docker-entrypoint.d
-ENTRYPOINT ["/docker-entrypoint.sh"]
-
-EXPOSE 80
-
-STOPSIGNAL SIGQUIT
-
-CMD ["nginx", "-g", "daemon off;"]
+    && if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi
diff --git a/stable/alpine-perl/docker-entrypoint.sh b/stable/alpine-perl/docker-entrypoint.sh
deleted file mode 100755
index e201fe6..0000000
--- a/stable/alpine-perl/docker-entrypoint.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-if [ "$1" = "nginx" -o "$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 "$@"
diff --git a/stable/alpine/10-listen-on-ipv6-by-default.sh b/stable/alpine/10-listen-on-ipv6-by-default.sh
deleted file mode 100755
index b265586..0000000
--- a/stable/alpine/10-listen-on-ipv6-by-default.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-ME=$(basename $0)
-DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
-
-# check if we have ipv6 available
-if [ ! -f "/proc/net/if_inet6" ]; then
-    entrypoint_log "$ME: info: ipv6 not available"
-    exit 0
-fi
-
-if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
-    entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE is not a file or does not exist"
-    exit 0
-fi
-
-# check if the file can be modified, e.g. not on a r/o filesystem
-touch /$DEFAULT_CONF_FILE 2>/dev/null || { entrypoint_log "$ME: info: can not modify /$DEFAULT_CONF_FILE (read-only file system?)"; exit 0; }
-
-# check if the file is already modified, e.g. on a container restart
-grep -q "listen  \[::]\:80;" /$DEFAULT_CONF_FILE && { entrypoint_log "$ME: info: IPv6 listen already enabled"; exit 0; }
-
-if [ -f "/etc/os-release" ]; then
-    . /etc/os-release
-else
-    entrypoint_log "$ME: info: can not guess the operating system"
-    exit 0
-fi
-
-entrypoint_log "$ME: info: Getting the checksum of /$DEFAULT_CONF_FILE"
-
-case "$ID" in
-    "debian")
-        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    "alpine")
-        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    *)
-        entrypoint_log "$ME: info: Unsupported distribution"
-        exit 0
-        ;;
-esac
-
-# enable ipv6 on default.conf listen sockets
-sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
-
-entrypoint_log "$ME: info: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
-
-exit 0
diff --git a/stable/alpine/20-envsubst-on-templates.sh b/stable/alpine/20-envsubst-on-templates.sh
deleted file mode 100755
index d0398b1..0000000
--- a/stable/alpine/20-envsubst-on-templates.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-set -e
-
-ME=$(basename $0)
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    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 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
-}
-
-auto_envsubst
-
-exit 0
diff --git a/stable/alpine/30-tune-worker-processes.sh b/stable/alpine/30-tune-worker-processes.sh
deleted file mode 100755
index 9aa42e9..0000000
--- a/stable/alpine/30-tune-worker-processes.sh
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/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
diff --git a/stable/alpine/Dockerfile b/stable/alpine/Dockerfile
index 86520fe..23d87fc 100644
--- a/stable/alpine/Dockerfile
+++ b/stable/alpine/Dockerfile
@@ -3,18 +3,11 @@
 #
 # PLEASE DO NOT EDIT IT DIRECTLY.
 #
-FROM alpine:3.17
+FROM nginx:1.22.1-alpine-slim
 
-LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-
-ENV NGINX_VERSION 1.22.1
 ENV NJS_VERSION   0.7.7
-ENV PKG_RELEASE   1
 
 RUN set -x \
-# create nginx user/group first, to be consistent throughout docker variants
-    && addgroup -g 101 -S nginx \
-    && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \
     && apkArch="$(cat /etc/apk/arch)" \
     && nginxPackages=" \
         nginx=${NGINX_VERSION}-r${PKG_RELEASE} \
@@ -58,7 +51,6 @@ RUN set -x \
                 libxslt-dev \
                 gd-dev \
                 geoip-dev \
-                perl-dev \
                 libedit-dev \
                 bash \
                 alpine-sdk \
@@ -77,7 +69,7 @@ RUN set -x \
                 && tar xzvf ${NGINX_VERSION}-${PKG_RELEASE}.tar.gz \
                 && cd pkg-oss-${NGINX_VERSION}-${PKG_RELEASE} \
                 && cd alpine \
-                && make all \
+                && make module-geoip module-image-filter module-njs module-xslt \
                 && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \
                 && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \
                 " \
@@ -92,42 +84,5 @@ RUN set -x \
     && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \
     && if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \
     && if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \
-# Bring in gettext so we can get `envsubst`, then throw
-# the rest away. To do this, we need to install `gettext`
-# then move `envsubst` out of the way so `gettext` can
-# be deleted completely, then move `envsubst` back.
-    && apk add --no-cache --virtual .gettext gettext \
-    && mv /usr/bin/envsubst /tmp/ \
-    \
-    && runDeps="$( \
-        scanelf --needed --nobanner /tmp/envsubst \
-            | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
-            | sort -u \
-            | xargs -r apk info --installed \
-            | sort -u \
-    )" \
-    && apk add --no-cache $runDeps \
-    && apk del .gettext \
-    && mv /tmp/envsubst /usr/local/bin/ \
-# Bring in tzdata so users could set the timezones through the environment
-# variables
-    && apk add --no-cache tzdata \
 # Bring in curl and ca-certificates to make registering on DNS SD easier
-    && apk add --no-cache curl ca-certificates \
-# forward request and error logs to docker log collector
-    && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log \
-# create a docker-entrypoint.d directory
-    && mkdir /docker-entrypoint.d
-
-COPY docker-entrypoint.sh /
-COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
-COPY 20-envsubst-on-templates.sh /docker-entrypoint.d
-COPY 30-tune-worker-processes.sh /docker-entrypoint.d
-ENTRYPOINT ["/docker-entrypoint.sh"]
-
-EXPOSE 80
-
-STOPSIGNAL SIGQUIT
-
-CMD ["nginx", "-g", "daemon off;"]
+    && apk add --no-cache curl ca-certificates
diff --git a/stable/alpine/docker-entrypoint.sh b/stable/alpine/docker-entrypoint.sh
deleted file mode 100755
index e201fe6..0000000
--- a/stable/alpine/docker-entrypoint.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-if [ "$1" = "nginx" -o "$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 "$@"
diff --git a/stable/debian-perl/10-listen-on-ipv6-by-default.sh b/stable/debian-perl/10-listen-on-ipv6-by-default.sh
deleted file mode 100755
index b265586..0000000
--- a/stable/debian-perl/10-listen-on-ipv6-by-default.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-ME=$(basename $0)
-DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
-
-# check if we have ipv6 available
-if [ ! -f "/proc/net/if_inet6" ]; then
-    entrypoint_log "$ME: info: ipv6 not available"
-    exit 0
-fi
-
-if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
-    entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE is not a file or does not exist"
-    exit 0
-fi
-
-# check if the file can be modified, e.g. not on a r/o filesystem
-touch /$DEFAULT_CONF_FILE 2>/dev/null || { entrypoint_log "$ME: info: can not modify /$DEFAULT_CONF_FILE (read-only file system?)"; exit 0; }
-
-# check if the file is already modified, e.g. on a container restart
-grep -q "listen  \[::]\:80;" /$DEFAULT_CONF_FILE && { entrypoint_log "$ME: info: IPv6 listen already enabled"; exit 0; }
-
-if [ -f "/etc/os-release" ]; then
-    . /etc/os-release
-else
-    entrypoint_log "$ME: info: can not guess the operating system"
-    exit 0
-fi
-
-entrypoint_log "$ME: info: Getting the checksum of /$DEFAULT_CONF_FILE"
-
-case "$ID" in
-    "debian")
-        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    "alpine")
-        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
-        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
-            entrypoint_log "$ME: info: /$DEFAULT_CONF_FILE differs from the packaged version"
-            exit 0
-        }
-        ;;
-    *)
-        entrypoint_log "$ME: info: Unsupported distribution"
-        exit 0
-        ;;
-esac
-
-# enable ipv6 on default.conf listen sockets
-sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
-
-entrypoint_log "$ME: info: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
-
-exit 0
diff --git a/stable/debian-perl/20-envsubst-on-templates.sh b/stable/debian-perl/20-envsubst-on-templates.sh
deleted file mode 100755
index d0398b1..0000000
--- a/stable/debian-perl/20-envsubst-on-templates.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-set -e
-
-ME=$(basename $0)
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    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 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
-}
-
-auto_envsubst
-
-exit 0
diff --git a/stable/debian-perl/30-tune-worker-processes.sh b/stable/debian-perl/30-tune-worker-processes.sh
deleted file mode 100755
index 9aa42e9..0000000
--- a/stable/debian-perl/30-tune-worker-processes.sh
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/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
diff --git a/stable/debian-perl/Dockerfile b/stable/debian-perl/Dockerfile
index c72c928..2a72881 100644
--- a/stable/debian-perl/Dockerfile
+++ b/stable/debian-perl/Dockerfile
@@ -3,18 +3,9 @@
 #
 # PLEASE DO NOT EDIT IT DIRECTLY.
 #
-FROM debian:bullseye-slim
-
-LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-
-ENV NGINX_VERSION   1.22.1
-ENV NJS_VERSION     0.7.7
-ENV PKG_RELEASE     1~bullseye
+FROM nginx:1.22.1
 
 RUN set -x \
-# create nginx user/group first, to be consistent throughout docker variants
-    && addgroup --system --gid 101 nginx \
-    && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx \
     && apt-get update \
     && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
     && \
@@ -59,11 +50,11 @@ RUN set -x \
             \
 # build .deb files from upstream's source packages (which are verified by apt-get)
             && apt-get update \
-            && apt-get build-dep -y $nginxPackages \
+            && apt-get build-dep -y nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} \
             && ( \
                 cd "$tempDir" \
                 && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
-                    apt-get source --compile $nginxPackages \
+                    apt-get source --compile nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} \
             ) \
 # we don't remove APT lists here because they get re-downloaded and removed later
             \
@@ -95,21 +86,4 @@ RUN set -x \
     && if [ -n "$tempDir" ]; then \
         apt-get purge -y --auto-remove \
         && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
-    fi \
-# forward request and error logs to docker log collector
-    && ln -sf /dev/stdout /var/log/nginx/access.log \
-    && ln -sf /dev/stderr /var/log/nginx/error.log \
-# create a docker-entrypoint.d directory
-    && mkdir /docker-entrypoint.d
-
-COPY docker-entrypoint.sh /
-COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
-COPY 20-envsubst-on-templates.sh /docker-entrypoint.d
-COPY 30-tune-worker-processes.sh /docker-entrypoint.d
-ENTRYPOINT ["/docker-entrypoint.sh"]
-
-EXPOSE 80
-
-STOPSIGNAL SIGQUIT
-
-CMD ["nginx", "-g", "daemon off;"]
+    fi
diff --git a/stable/debian-perl/docker-entrypoint.sh b/stable/debian-perl/docker-entrypoint.sh
deleted file mode 100755
index e201fe6..0000000
--- a/stable/debian-perl/docker-entrypoint.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# vim:sw=4:ts=4:et
-
-set -e
-
-entrypoint_log() {
-    if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
-        echo "$@"
-    fi
-}
-
-if [ "$1" = "nginx" -o "$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 "$@"
-- 
GitLab