From 5aac607c2774dba61bfffbee15edadfa7d35964e Mon Sep 17 00:00:00 2001 From: fabiocicerchia Date: Tue, 24 May 2022 00:01:59 +0000 Subject: [PATCH] Automated updates --- Dockerfile | 2 +- Dockerfile-compat | 5 +- README.md | 4 +- docs/TAGS.md | 10 +- nginx/1.21.6/alpine/3.16.0/Dockerfile | 411 ++++++++++++++++++ nginx/1.21.6/alpine/3.16.0/Dockerfile-compat | 410 +++++++++++++++++ .../tpl/10-listen-on-ipv6-by-default.sh | 61 +++ .../3.16.0/tpl/20-envsubst-on-templates.sh | 32 ++ nginx/1.21.6/alpine/3.16.0/tpl/Makefile | 242 +++++++++++ nginx/1.21.6/alpine/3.16.0/tpl/default.conf | 44 ++ .../alpine/3.16.0/tpl/docker-entrypoint.sh | 40 ++ nginx/1.21.6/alpine/3.16.0/tpl/nginx.conf | 31 ++ nginx/1.21.6/alpine/3.16.0/tpl/support.sh | 17 + supported_versions | 2 +- 14 files changed, 1301 insertions(+), 10 deletions(-) create mode 100644 nginx/1.21.6/alpine/3.16.0/Dockerfile create mode 100644 nginx/1.21.6/alpine/3.16.0/Dockerfile-compat create mode 100755 nginx/1.21.6/alpine/3.16.0/tpl/10-listen-on-ipv6-by-default.sh create mode 100755 nginx/1.21.6/alpine/3.16.0/tpl/20-envsubst-on-templates.sh create mode 100644 nginx/1.21.6/alpine/3.16.0/tpl/Makefile create mode 100644 nginx/1.21.6/alpine/3.16.0/tpl/default.conf create mode 100755 nginx/1.21.6/alpine/3.16.0/tpl/docker-entrypoint.sh create mode 100644 nginx/1.21.6/alpine/3.16.0/tpl/nginx.conf create mode 100755 nginx/1.21.6/alpine/3.16.0/tpl/support.sh diff --git a/Dockerfile b/Dockerfile index 50959eae..33efa86a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ARG ARCH= ARG DISTRO=alpine -ARG DISTRO_VER=3.15.4 +ARG DISTRO_VER=3.16.0 ############################# # Settings Common Variables # diff --git a/Dockerfile-compat b/Dockerfile-compat index e2bed33b..88310d7a 100644 --- a/Dockerfile-compat +++ b/Dockerfile-compat @@ -9,7 +9,7 @@ ARG ARCH= ARG DISTRO=alpine -ARG DISTRO_VER=3.15 +ARG DISTRO_VER=3.16.0 ############################# # Settings Common Variables # @@ -40,6 +40,7 @@ ENV VER_NGX_DEVEL_KIT=$VER_NGX_DEVEL_KIT # luajit2 # https://github.com/openresty/luajit2/tags +# Note: LuaJIT2 is stuck on Lua 5.1 since 2009. ARG VER_LUAJIT=2.1-20220310 ENV VER_LUAJIT=$VER_LUAJIT ARG LUAJIT_LIB=/usr/local/lib @@ -61,7 +62,7 @@ ENV VER_LUA_NGINX_MODULE=$VER_LUA_NGINX_MODULE # This library is production ready. ARG VER_LUA_RESTY_CORE=0.1.22 ENV VER_LUA_RESTY_CORE=$VER_LUA_RESTY_CORE -ARG LUA_LIB_DIR=/usr/local/share/lua/5.1 +ARG LUA_LIB_DIR=/usr/local/share/lua/5.4 ENV LUA_LIB_DIR=$LUA_LIB_DIR # lua-resty-lrucache diff --git a/README.md b/README.md index c49180f9..196b153e 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ If you'd like to support this open-source project I'll appreciate any kind of [c - [`almalinux`, `1-almalinux`, `1.21-almalinux`, `1.21.6-almalinux`, `1-almalinux8.6-20220512`, `1.21-almalinux8.6-20220512`, `1.21.6-almalinux8.6-20220512`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/almalinux/8.6-20220512/Dockerfile) - [`almalinux-compat`, `1-almalinux-compat`, `1.21-almalinux-compat`, `1.21.6-almalinux-compat`, `1-almalinux8.6-20220512-compat`, `1.21-almalinux8.6-20220512-compat`, `1.21.6-almalinux8.6-20220512-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/almalinux/8.6-20220512/Dockerfile-compat) -- [`1`, `1.21`, `1.21.6`, `alpine`, `latest`, `1-alpine`, `1.21-alpine`, `1.21.6-alpine`, `1-alpine3.15.4`, `1.21-alpine3.15.4`, `1.21.6-alpine3.15.4`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.4/Dockerfile) -- [`1-compat`, `1.21-compat`, `1.21.6-compat`, `alpine-compat`, `latest-compat`, `1-alpine-compat`, `1.21-alpine-compat`, `1.21.6-alpine-compat`, `1-alpine3.15.4-compat`, `1.21-alpine3.15.4-compat`, `1.21.6-alpine3.15.4-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.4/Dockerfile-compat) +- [`1`, `1.21`, `1.21.6`, `alpine`, `latest`, `1-alpine`, `1.21-alpine`, `1.21.6-alpine`, `1-alpine3.16.0`, `1.21-alpine3.16.0`, `1.21.6-alpine3.16.0`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.16.0/Dockerfile) +- [`1-compat`, `1.21-compat`, `1.21.6-compat`, `alpine-compat`, `latest-compat`, `1-alpine-compat`, `1.21-alpine-compat`, `1.21.6-alpine-compat`, `1-alpine3.16.0-compat`, `1.21-alpine3.16.0-compat`, `1.21.6-alpine3.16.0-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.16.0/Dockerfile-compat) - [`amazonlinux`, `1-amazonlinux`, `1.21-amazonlinux`, `1.21.6-amazonlinux`, `1-amazonlinux2.0.20220426.0`, `1.21-amazonlinux2.0.20220426.0`, `1.21.6-amazonlinux2.0.20220426.0`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/amazonlinux/2.0.20220426.0/Dockerfile) - [`amazonlinux-compat`, `1-amazonlinux-compat`, `1.21-amazonlinux-compat`, `1.21.6-amazonlinux-compat`, `1-amazonlinux2.0.20220426.0-compat`, `1.21-amazonlinux2.0.20220426.0-compat`, `1.21.6-amazonlinux2.0.20220426.0-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/amazonlinux/2.0.20220426.0/Dockerfile-compat) - [`debian`, `1-debian`, `1.21-debian`, `1-debian11.3`, `1.21.6-debian`, `1.21-debian11.3`, `1.21.6-debian11.3`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/debian/11.3/Dockerfile) diff --git a/docs/TAGS.md b/docs/TAGS.md index 1c8939d9..2fcbaa69 100644 --- a/docs/TAGS.md +++ b/docs/TAGS.md @@ -4,8 +4,8 @@ - [`1.21.6-almalinux`, `1.21-almalinux`, `1-almalinux`, `1.21.6-almalinux8.6-20220512`, `1.21-almalinux8.6-20220512`, `1-almalinux8.6-20220512`, `almalinux`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/almalinux/8.6-20220512/Dockerfile) - [`1.21.6-almalinux-compat`, `1.21-almalinux-compat`, `1-almalinux-compat`, `1.21.6-almalinux8.6-20220512-compat`, `1.21-almalinux8.6-20220512-compat`, `1-almalinux8.6-20220512-compat`, `almalinux-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/almalinux/8.6-20220512/Dockerfile-compat) -- [`1.21.6-alpine3.15.4`, `1.21-alpine3.15.4`, `1-alpine3.15.4`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.4/Dockerfile) -- [`1.21.6-alpine3.15.4-compat`, `1.21-alpine3.15.4-compat`, `1-alpine3.15.4-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.4/Dockerfile-compat) +- [`1-alpine`, `1`, `1.21-alpine`, `1.21`, `1.21.6-alpine`, `1.21-6`, `1.21.6-alpine3.16.0`, `1.21-alpine3.16.0`, `1-alpine3.16.0`, `alpine`, `latest`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.16.0/Dockerfile) +- [`1.21-alpine-compat`, `1.21-compat`, `1-alpine-compat`, `1-compat`, `1.21.6-alpine-compat`, `1.21-6-compat`, `1.21.6-alpine3.16.0-compat`, `1.21-alpine3.16.0-compat`, `1-alpine3.16.0-compat`, `alpine-compat`, `latest-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.16.0/Dockerfile-compat) - [`1-amazonlinux`, `1.21-amazonlinux`, `1.21.6-amazonlinux`, `1.21.6-amazonlinux2.0.20220426.0`, `1.21-amazonlinux2.0.20220426.0`, `1-amazonlinux2.0.20220426.0`, `amazonlinux`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/amazonlinux/2.0.20220426.0/Dockerfile) - [`1.21-amazonlinux-compat`, `1-amazonlinux-compat`, `1.21.6-amazonlinux-compat`, `1.21.6-amazonlinux2.0.20220426.0-compat`, `1.21-amazonlinux2.0.20220426.0-compat`, `1-amazonlinux2.0.20220426.0-compat`, `amazonlinux-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/amazonlinux/2.0.20220426.0/Dockerfile-compat) - [`1-debian`, `1.21-debian`, `1.21.6-debian`, `1.21.6-debian11.3`, `1.21-debian11.3`, `1-debian11.3`, `debian`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/debian/11.3/Dockerfile) @@ -35,8 +35,10 @@ - [`1.21.6-amazonlinux2.0.20220121.0`, `1.21-amazonlinux2.0.20220121.0`, `1-amazonlinux2.0.20220121.0`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/amazonlinux/2.0.20220121.0/Dockerfile) - [`1.21-amazonlinux2.0.20211223.0-compat`, `1-amazonlinux2.0.20211223.0-compat`, `1.21.6-amazonlinux2.0.20211223.0-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/amazonlinux/2.0.20211223.0/Dockerfile-compat) - [`1.21-amazonlinux2.0.20211223.0`, `1-amazonlinux2.0.20211223.0`, `1.21.6-amazonlinux2.0.20211223.0`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/amazonlinux/2.0.20211223.0/Dockerfile) -- [`1.21-alpine-compat`, `1.21-compat`, `1-alpine-compat`, `1-compat`, `1.21.6-alpine-compat`, `1.21-6-compat`, `1.21.6-alpine3.15-compat`, `1.21-alpine3.15-compat`, `1-alpine3.15-compat`, `alpine-compat`, `latest-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15/Dockerfile-compat) -- [`1-alpine`, `1`, `1.21-alpine`, `1.21`, `1.21.6-alpine`, `1.21-6`, `1.21.6-alpine3.15`, `1.21-alpine3.15`, `1-alpine3.15`, `alpine`, `latest`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15/Dockerfile) +- [`1.21.6-alpine3.15-compat`, `1.21-alpine3.15-compat`, `1-alpine3.15-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15/Dockerfile-compat) +- [`1.21.6-alpine3.15`, `1.21-alpine3.15`, `1-alpine3.15`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15/Dockerfile) +- [`1.21.6-alpine3.15.4-compat`, `1.21-alpine3.15.4-compat`, `1-alpine3.15.4-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.4/Dockerfile-compat) +- [`1.21.6-alpine3.15.4`, `1.21-alpine3.15.4`, `1-alpine3.15.4`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.4/Dockerfile) - [`1.21.6-alpine3.15.3-compat`, `1.21-alpine3.15.3-compat`, `1-alpine3.15.3-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.3/Dockerfile-compat) - [`1.21.6-alpine3.15.3`, `1.21-alpine3.15.3`, `1-alpine3.15.3`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.3/Dockerfile) - [`1.21.6-alpine3.15.2-compat`, `1.21-alpine3.15.2-compat`, `1-alpine3.15.2-compat`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.2/Dockerfile-compat) diff --git a/nginx/1.21.6/alpine/3.16.0/Dockerfile b/nginx/1.21.6/alpine/3.16.0/Dockerfile new file mode 100644 index 00000000..33efa86a --- /dev/null +++ b/nginx/1.21.6/alpine/3.16.0/Dockerfile @@ -0,0 +1,411 @@ +# __ __ +# .-----.-----.|__|.-----.--.--.______| |.--.--.---.-. +# | | _ || || |_ _|______| || | | _ | +# |__|__|___ ||__||__|__|__.__| |__||_____|___._| +# |_____| +# +# Copyright (c) 2022 Fabio Cicerchia. https://fabiocicerchia.it. MIT License +# Repo: https://github.com/fabiocicerchia/nginx-lua + +ARG ARCH= +ARG DISTRO=alpine +ARG DISTRO_VER=3.16.0 + +############################# +# Settings Common Variables # +############################# +FROM ${ARCH}/$DISTRO:$DISTRO_VER AS base + +ARG ARCH= +ENV ARCH=$ARCH + +ENV DOCKER_IMAGE=fabiocicerchia/nginx-lua +ENV DOCKER_IMAGE_OS=${DISTRO} +ENV DOCKER_IMAGE_TAG=${DISTRO_VER} + +ARG BUILD_DATE +ENV BUILD_DATE=$BUILD_DATE +ARG VCS_REF +ENV VCS_REF=$VCS_REF + +# lua +ARG VER_LUA=5.4 +ENV VER_LUA=$VER_LUA + +# ngx_devel_kit +# https://github.com/vision5/ngx_devel_kit/releases +# The NDK is now considered to be stable. +ARG VER_NGX_DEVEL_KIT=0.3.1 +ENV VER_NGX_DEVEL_KIT=$VER_NGX_DEVEL_KIT + +# luajit2 +# https://github.com/openresty/luajit2/tags +# Note: LuaJIT2 is stuck on Lua 5.1 since 2009. +ARG VER_LUAJIT=2.1-20220310 +ENV VER_LUAJIT=$VER_LUAJIT +ARG LUAJIT_LIB=/usr/local/lib +ENV LUAJIT_LIB=$LUAJIT_LIB +ARG LUAJIT_INC=/usr/local/include/luajit-2.1 +ENV LUAJIT_INC=$LUAJIT_INC +ARG LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH +ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH + +# lua-nginx-module +# https://github.com/openresty/lua-nginx-module/tags +# Production ready. +ARG VER_LUA_NGINX_MODULE=0.10.20 +ENV VER_LUA_NGINX_MODULE=$VER_LUA_NGINX_MODULE + +# lua-resty-core +# https://github.com/openresty/lua-resty-core/tags +# This library is production ready. +ARG VER_LUA_RESTY_CORE=0.1.22 +ENV VER_LUA_RESTY_CORE=$VER_LUA_RESTY_CORE +ARG LUA_LIB_DIR=/usr/local/share/lua/5.4 +ENV LUA_LIB_DIR=$LUA_LIB_DIR + +# lua-resty-lrucache +# https://github.com/openresty/lua-resty-lrucache/tags +# This library is considered production ready. +ARG VER_LUA_RESTY_LRUCACHE=0.11 +ENV VER_LUA_RESTY_LRUCACHE=$VER_LUA_RESTY_LRUCACHE + +# headers-more-nginx-module +# https://github.com/openresty/headers-more-nginx-module/commits/master +ARG VER_OPENRESTY_HEADERS=a4a0686605161a6777d7d612d5aef79b9e7c13e0 +ENV VER_OPENRESTY_HEADERS=$VER_OPENRESTY_HEADERS + +# lua-resty-cookie +# https://github.com/cloudflare/lua-resty-cookie/commits/master +ARG VER_CLOUDFLARE_COOKIE=99be1005e38ce19ace54515272a2be1b9fdc5da2 +ENV VER_CLOUDFLARE_COOKIE=$VER_CLOUDFLARE_COOKIE + +# lua-resty-dns +# https://github.com/openresty/lua-resty-dns/tags +ARG VER_OPENRESTY_DNS=0.22 +ENV VER_OPENRESTY_DNS=$VER_OPENRESTY_DNS + +# lua-resty-memcached +# https://github.com/openresty/lua-resty-memcached/tags +ARG VER_OPENRESTY_MEMCACHED=0.16 +ENV VER_OPENRESTY_MEMCACHED=$VER_OPENRESTY_MEMCACHED + +# lua-resty-mysql +# https://github.com/openresty/lua-resty-mysql/tags +ARG VER_OPENRESTY_MYSQL=0.24 +ENV VER_OPENRESTY_MYSQL=$VER_OPENRESTY_MYSQL + +# lua-resty-redis +# https://github.com/openresty/lua-resty-redis/releases +ARG VER_OPENRESTY_REDIS=0.29 +ENV VER_OPENRESTY_REDIS=$VER_OPENRESTY_REDIS + +# lua-resty-shell +# https://github.com/openresty/lua-resty-shell/tags +ARG VER_OPENRESTY_SHELL=0.03 +ENV VER_OPENRESTY_SHELL=$VER_OPENRESTY_SHELL + +# lua-resty-signal +# https://github.com/openresty/lua-resty-signal/tags +ARG VER_OPENRESTY_SIGNAL=0.03 +ENV VER_OPENRESTY_SIGNAL=$VER_OPENRESTY_SIGNAL + +# lua-tablepool +# https://github.com/openresty/lua-tablepool/tags +ARG VER_OPENRESTY_TABLEPOOL=0.02 +ENV VER_OPENRESTY_TABLEPOOL=$VER_OPENRESTY_TABLEPOOL + +# lua-resty-upstream-healthcheck +# https://github.com/openresty/lua-resty-upstream-healthcheck/tags +ARG VER_OPENRESTY_HEALTHCHECK=0.06 +ENV VER_OPENRESTY_HEALTHCHECK=$VER_OPENRESTY_HEALTHCHECK + +# lua-resty-websocket +# https://github.com/openresty/lua-resty-websocket/tags +ARG VER_OPENRESTY_WEBSOCKET=0.08 +ENV VER_OPENRESTY_WEBSOCKET=$VER_OPENRESTY_WEBSOCKET + +# lua-rocks +# https://luarocks.github.io/luarocks/releases/ +ARG VER_LUAROCKS=3.8.0 +ENV VER_LUAROCKS=$VER_LUAROCKS + +# lua-upstream-nginx-module +# https://github.com/openresty/lua-upstream-nginx-module/tags +ARG VER_LUA_UPSTREAM=0.07 +ENV VER_LUA_UPSTREAM=$VER_LUA_UPSTREAM + +# nginx-lua-prometheus +# https://github.com/knyar/nginx-lua-prometheus/tags +ARG VER_PROMETHEUS=0.20220127 +ENV VER_PROMETHEUS=$VER_PROMETHEUS + +# stream-lua-nginx-module +# https://github.com/openresty/stream-lua-nginx-module/tags +ARG VER_OPENRESTY_STREAMLUA=0.0.10 +ENV VER_OPENRESTY_STREAMLUA=$VER_OPENRESTY_STREAMLUA + +# https://github.com/nginx/nginx/releases +ARG VER_NGINX=1.21.6 +ENV VER_NGINX=$VER_NGINX +# References: +# - https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc +# - https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html +# -g Generate debugging information +# -O2 Recommended optimizations +# -fstack-protector-strong Stack smashing protector +# -Wformat Check calls to make sure that the arguments supplied have types appropriate to the format string specified +# -Werror=format-security Reject potentially unsafe format string arguents +# -Wp,-D_FORTIFY_SOURCE=2 Run-time buffer overflow detection +# -fPIC No text relocations +ARG NGX_CFLAGS="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC" +ENV NGX_CFLAGS=$NGX_CFLAGS +# References +# - https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc +# - https://wiki.debian.org/ToolChain/DSOLinking#Unresolved_symbols_in_shared_libraries +# - https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html +# - https://linux.die.net/man/1/ld +# -Wl,-rpath,/usr/local/lib Add a directory to the runtime library search path +# -Wl,-z,relro Read-only segments after relocation +# -Wl,-z,now Disable lazy binding +# -Wl,--as-needed Only link with needed libraries +# -pie Full ASLR for executables +ARG NGX_LDOPT="-Wl,-rpath,/usr/local/lib -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie" +ENV NGX_LDOPT=$NGX_LDOPT +# Reference: http://nginx.org/en/docs/configure.html +ARG NGINX_BUILD_CONFIG="\ + --prefix=/etc/nginx \ + --sbin-path=/usr/sbin/nginx \ + --modules-path=/usr/lib/nginx/modules \ + --conf-path=/etc/nginx/nginx.conf \ + --error-log-path=/var/log/nginx/error.log \ + --http-log-path=/var/log/nginx/access.log \ + --pid-path=/var/run/nginx.pid \ + --lock-path=/var/run/nginx.lock \ + --http-client-body-temp-path=/var/cache/nginx/client_temp \ + --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ + --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ + --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ + --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ + --with-perl_modules_path=/usr/lib/perl5/vendor_perl \ + --user=nginx \ + --group=nginx \ + --with-compat \ + --with-file-aio \ + --with-threads \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_mp4_module \ + --with-http_random_index_module \ + --with-http_realip_module \ + --with-http_secure_link_module \ + --with-http_slice_module \ + --with-http_ssl_module \ + --with-http_stub_status_module \ + --with-http_sub_module \ + --with-http_v2_module \ + --with-mail \ + --with-mail_ssl_module \ + --with-stream \ + --with-stream_realip_module \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --add-module=/lua-nginx-module-${VER_LUA_NGINX_MODULE} \ + --add-module=/ngx_devel_kit-${VER_NGX_DEVEL_KIT} \ + --add-module=/lua-upstream-nginx-module-${VER_LUA_UPSTREAM} \ + --add-module=/headers-more-nginx-module-${VER_OPENRESTY_HEADERS} \ + --add-module=/stream-lua-nginx-module-${VER_OPENRESTY_STREAMLUA} \ +" +ENV NGINX_BUILD_CONFIG=$NGINX_BUILD_CONFIG + +ARG BUILD_DEPS_BASE="\ + curl \ + geoip-dev \ + gzip \ + lua${VER_LUA} \ + lua${VER_LUA}-dev \ + make \ + openssl-dev \ + patch \ + pcre-dev \ + tar \ + zlib-dev \ +" +ENV BUILD_DEPS_BASE=$BUILD_DEPS_BASE +ARG BUILD_DEPS_AMD64="\ + ${BUILD_DEPS_BASE} \ + g++ \ +" +ENV BUILD_DEPS_AMD64=$BUILD_DEPS_AMD64 +ARG BUILD_DEPS_ARM64V8="\ + ${BUILD_DEPS_BASE} \ + gcc-aarch64-none-elf \ +" +ENV BUILD_DEPS_ARM64V8=$BUILD_DEPS_ARM64V8 +ENV BUILD_DEPS= + +ARG NGINX_BUILD_DEPS="\ +# NGINX + alpine-sdk \ + bash \ + findutils \ + gd-dev \ + libedit-dev \ + libxslt-dev \ + linux-headers \ + perl-dev \ +" +ENV NGINX_BUILD_DEPS=$NGINX_BUILD_DEPS + +#################################### +# Build Nginx with support for LUA # +#################################### +FROM base AS builder + +# hadolint ignore=SC2086 +RUN set -eux \ + && eval BUILD_DEPS="\$$(echo BUILD_DEPS_${ARCH} | tr '[:lower:]' '[:upper:]')" \ + && apk update \ + && apk add --no-cache \ + $BUILD_DEPS \ + $NGINX_BUILD_DEPS + +COPY tpl/Makefile Makefile + +RUN make deps \ + && make core \ + && make luarocks + +########################################## +# Combine everything with minimal layers # +########################################## +FROM base + +# http://label-schema.org/rc1/ +LABEL maintainer="Fabio Cicerchia " \ + org.label-schema.build-date="${BUILD_DATE}" \ + org.label-schema.description="Nginx ${VER_NGINX} with Lua support based on ${DOCKER_IMAGE_OS} ${DOCKER_IMAGE_TAG}." \ + org.label-schema.docker.cmd="docker run -p 80:80 -d ${DOCKER_IMAGE}:${VER_NGINX}-${DOCKER_IMAGE_OS}${DOCKER_IMAGE_TAG}" \ + org.label-schema.name="${DOCKER_IMAGE}" \ + org.label-schema.schema-version="1.0" \ + org.label-schema.url="https://github.com/${DOCKER_IMAGE}" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url="https://github.com/${DOCKER_IMAGE}" \ + org.label-schema.version="${VER_NGINX}-${DOCKER_IMAGE_OS}${DOCKER_IMAGE_TAG}" \ + image.target.platform="${TARGETPLATFORM}" \ + image.target.os="${TARGETOS}" \ + image.target.arch="${ARCH}" \ + versions.headers-more-nginx-module="${VER_OPENRESTY_HEADERS}" \ + versions.lua="${VER_LUA}" \ + versions.luarocks="${VER_LUAROCKS}" \ + versions.lua-nginx-module="${VER_LUA_NGINX_MODULE}" \ + versions.lua-resty-cookie="${VER_CLOUDFLARE_COOKIE}" \ + versions.lua-resty-core="${VER_LUA_RESTY_CORE}" \ + versions.lua-resty-dns="${VER_OPENRESTY_DNS}" \ + versions.lua-resty-lrucache="${VER_LUA_RESTY_LRUCACHE}" \ + versions.lua-resty-memcached="${VER_OPENRESTY_MEMCACHED}" \ + versions.lua-resty-mysql="${VER_OPENRESTY_MYSQL}" \ + versions.lua-resty-redis="${VER_OPENRESTY_REDIS}" \ + versions.lua-resty-shell="${VER_OPENRESTY_SHELL}" \ + versions.lua-resty-signal="${VER_OPENRESTY_SIGNAL}" \ + versions.lua-resty-tablepool="${VER_OPENRESTY_TABLEPOOL}" \ + versions.lua-resty-upstream-healthcheck="${VER_OPENRESTY_HEALTHCHECK}" \ + versions.lua-resty-websocket="${VER_OPENRESTY_WEBSOCKET}" \ + versions.lua-upstream="${VER_LUA_UPSTREAM}" \ + versions.luajit2="${VER_LUAJIT}" \ + versions.nginx-lua-prometheus="${VER_PROMETHEUS}" \ + versions.nginx="${VER_NGINX}" \ + versions.ngx_devel_kit="${VER_NGX_DEVEL_KIT}" \ + versions.os="${DOCKER_IMAGE_TAG}" \ + versions.stream-lua-nginx-module="${VER_OPENRESTY_STREAMLUA}" + +ARG PKG_DEPS="\ + geoip-dev \ + lua${VER_LUA} \ + lua${VER_LUA}-dev \ + openssl-dev \ + pcre-dev \ + unzip \ + zlib-dev \ +" +ENV PKG_DEPS=$PKG_DEPS + +COPY --from=builder --chown=101:101 /etc/nginx /etc/nginx +COPY --from=builder --chown=101:101 /usr/local/lib /usr/local/lib +COPY --from=builder --chown=101:101 /usr/local/share/lua /usr/local/share/lua +COPY --from=builder --chown=101:101 /usr/sbin/nginx /usr/sbin/nginx +COPY --from=builder --chown=101:101 /usr/sbin/nginx-debug /usr/sbin/nginx-debug +COPY --from=builder --chown=101:101 /var/cache/nginx /var/cache/nginx +COPY --from=builder --chown=101:101 /usr/local/bin/luarocks /usr/local/bin/luarocks +COPY --from=builder --chown=101:101 /usr/local/etc/luarocks /usr/local/etc/luarocks + +COPY --chown=101:101 tpl/support.sh / +COPY --chown=101:101 tpl/docker-entrypoint.sh / +COPY --chown=101:101 tpl/10-listen-on-ipv6-by-default.sh /docker-entrypoint.d/ +COPY --chown=101:101 tpl/20-envsubst-on-templates.sh /docker-entrypoint.d/ +COPY --chown=101:101 tpl/nginx.conf /etc/nginx/nginx.conf +COPY --chown=101:101 tpl/default.conf /etc/nginx/conf.d/default.conf + +SHELL ["/bin/ash", "-eo", "pipefail", "-c"] + +# hadolint ignore=SC2086 +RUN set -eux \ + && apk update \ + && apk add --no-cache --virtual .pkg_deps \ + $PKG_DEPS \ +# Fix LUA alias + && ln -sf /usr/bin/lua${VER_LUA} /usr/local/bin/lua \ +# 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 --virtual .run_deps $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 --virtual pkg_tz tzdata \ +# Bring in curl and ca-certificates to make registering on DNS SD easier + && apk add --no-cache --virtual pkg_dns curl ca-certificates \ +# forward request and error logs to docker log collector + && mkdir -p /var/log/nginx \ + && ln -sf /dev/stdout /var/log/nginx/access.log \ + && ln -sf /dev/stderr /var/log/nginx/error.log \ +# 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 \ +# Upgrade software to latest version +# ############################################################################## + && apk upgrade + +# smoke test +# ############################################################################## +RUN envsubst -V \ + && nginx -V \ + && nginx -t \ + && lua -v \ + && luarocks --version + +EXPOSE 80 443 + +HEALTHCHECK --interval=30s --timeout=3s CMD curl --fail http://localhost/ || exit 1 + +# Override stop signal to stop process gracefully +STOPSIGNAL SIGQUIT + +ENTRYPOINT ["/docker-entrypoint.sh"] + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx/1.21.6/alpine/3.16.0/Dockerfile-compat b/nginx/1.21.6/alpine/3.16.0/Dockerfile-compat new file mode 100644 index 00000000..88310d7a --- /dev/null +++ b/nginx/1.21.6/alpine/3.16.0/Dockerfile-compat @@ -0,0 +1,410 @@ +# __ __ +# .-----.-----.|__|.-----.--.--.______| |.--.--.---.-. +# | | _ || || |_ _|______| || | | _ | +# |__|__|___ ||__||__|__|__.__| |__||_____|___._| +# |_____| +# +# Copyright (c) 2022 Fabio Cicerchia. https://fabiocicerchia.it. MIT License +# Repo: https://github.com/fabiocicerchia/nginx-lua + +ARG ARCH= +ARG DISTRO=alpine +ARG DISTRO_VER=3.16.0 + +############################# +# Settings Common Variables # +############################# +FROM ${ARCH}/$DISTRO:$DISTRO_VER AS base + +ARG ARCH= +ENV ARCH=$ARCH + +ENV DOCKER_IMAGE=fabiocicerchia/nginx-lua +ENV DOCKER_IMAGE_OS=${DISTRO} +ENV DOCKER_IMAGE_TAG=${DISTRO_VER} + +ARG BUILD_DATE +ENV BUILD_DATE=$BUILD_DATE +ARG VCS_REF +ENV VCS_REF=$VCS_REF + +# lua +ARG VER_LUA=5.4.3 +ENV VER_LUA=$VER_LUA + +# ngx_devel_kit +# https://github.com/vision5/ngx_devel_kit/releases +# The NDK is now considered to be stable. +ARG VER_NGX_DEVEL_KIT=0.3.1 +ENV VER_NGX_DEVEL_KIT=$VER_NGX_DEVEL_KIT + +# luajit2 +# https://github.com/openresty/luajit2/tags +# Note: LuaJIT2 is stuck on Lua 5.1 since 2009. +ARG VER_LUAJIT=2.1-20220310 +ENV VER_LUAJIT=$VER_LUAJIT +ARG LUAJIT_LIB=/usr/local/lib +ENV LUAJIT_LIB=$LUAJIT_LIB +ARG LUAJIT_INC=/usr/local/include/luajit-2.1 +ENV LUAJIT_INC=$LUAJIT_INC +ENV LUA_INCDIR=$LUAJIT_INC +ARG LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH +ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH + +# lua-nginx-module +# https://github.com/openresty/lua-nginx-module/tags +# Production ready. +ARG VER_LUA_NGINX_MODULE=0.10.20 +ENV VER_LUA_NGINX_MODULE=$VER_LUA_NGINX_MODULE + +# lua-resty-core +# https://github.com/openresty/lua-resty-core/tags +# This library is production ready. +ARG VER_LUA_RESTY_CORE=0.1.22 +ENV VER_LUA_RESTY_CORE=$VER_LUA_RESTY_CORE +ARG LUA_LIB_DIR=/usr/local/share/lua/5.4 +ENV LUA_LIB_DIR=$LUA_LIB_DIR + +# lua-resty-lrucache +# https://github.com/openresty/lua-resty-lrucache/tags +# This library is considered production ready. +ARG VER_LUA_RESTY_LRUCACHE=0.11 +ENV VER_LUA_RESTY_LRUCACHE=$VER_LUA_RESTY_LRUCACHE + +# headers-more-nginx-module +# https://github.com/openresty/headers-more-nginx-module/commits/master +ARG VER_OPENRESTY_HEADERS=a4a0686605161a6777d7d612d5aef79b9e7c13e0 +ENV VER_OPENRESTY_HEADERS=$VER_OPENRESTY_HEADERS + +# lua-resty-cookie +# https://github.com/cloudflare/lua-resty-cookie/commits/master +ARG VER_CLOUDFLARE_COOKIE=99be1005e38ce19ace54515272a2be1b9fdc5da2 +ENV VER_CLOUDFLARE_COOKIE=$VER_CLOUDFLARE_COOKIE + +# lua-resty-dns +# https://github.com/openresty/lua-resty-dns/tags +ARG VER_OPENRESTY_DNS=0.22 +ENV VER_OPENRESTY_DNS=$VER_OPENRESTY_DNS + +# lua-resty-memcached +# https://github.com/openresty/lua-resty-memcached/tags +ARG VER_OPENRESTY_MEMCACHED=0.16 +ENV VER_OPENRESTY_MEMCACHED=$VER_OPENRESTY_MEMCACHED + +# lua-resty-mysql +# https://github.com/openresty/lua-resty-mysql/tags +ARG VER_OPENRESTY_MYSQL=0.24 +ENV VER_OPENRESTY_MYSQL=$VER_OPENRESTY_MYSQL + +# lua-resty-redis +# https://github.com/openresty/lua-resty-redis/releases +ARG VER_OPENRESTY_REDIS=0.29 +ENV VER_OPENRESTY_REDIS=$VER_OPENRESTY_REDIS + +# lua-resty-shell +# https://github.com/openresty/lua-resty-shell/tags +ARG VER_OPENRESTY_SHELL=0.03 +ENV VER_OPENRESTY_SHELL=$VER_OPENRESTY_SHELL + +# lua-resty-signal +# https://github.com/openresty/lua-resty-signal/tags +ARG VER_OPENRESTY_SIGNAL=0.03 +ENV VER_OPENRESTY_SIGNAL=$VER_OPENRESTY_SIGNAL + +# lua-tablepool +# https://github.com/openresty/lua-tablepool/tags +ARG VER_OPENRESTY_TABLEPOOL=0.02 +ENV VER_OPENRESTY_TABLEPOOL=$VER_OPENRESTY_TABLEPOOL + +# lua-resty-upstream-healthcheck +# https://github.com/openresty/lua-resty-upstream-healthcheck/tags +ARG VER_OPENRESTY_HEALTHCHECK=0.06 +ENV VER_OPENRESTY_HEALTHCHECK=$VER_OPENRESTY_HEALTHCHECK + +# lua-resty-websocket +# https://github.com/openresty/lua-resty-websocket/tags +ARG VER_OPENRESTY_WEBSOCKET=0.08 +ENV VER_OPENRESTY_WEBSOCKET=$VER_OPENRESTY_WEBSOCKET + +# lua-rocks +# https://luarocks.github.io/luarocks/releases/ +ARG VER_LUAROCKS=3.8.0 +ENV VER_LUAROCKS=$VER_LUAROCKS + +# lua-upstream-nginx-module +# https://github.com/openresty/lua-upstream-nginx-module/tags +ARG VER_LUA_UPSTREAM=0.07 +ENV VER_LUA_UPSTREAM=$VER_LUA_UPSTREAM + +# nginx-lua-prometheus +# https://github.com/knyar/nginx-lua-prometheus/tags +ARG VER_PROMETHEUS=0.20220127 +ENV VER_PROMETHEUS=$VER_PROMETHEUS + +# stream-lua-nginx-module +# https://github.com/openresty/stream-lua-nginx-module/tags +ARG VER_OPENRESTY_STREAMLUA=0.0.10 +ENV VER_OPENRESTY_STREAMLUA=$VER_OPENRESTY_STREAMLUA + +# https://github.com/nginx/nginx/releases +ARG VER_NGINX=1.21.6 +ENV VER_NGINX=$VER_NGINX +# References: +# - https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc +# - https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html +# -g Generate debugging information +# -O2 Recommended optimizations +# -fstack-protector-strong Stack smashing protector +# -Wformat Check calls to make sure that the arguments supplied have types appropriate to the format string specified +# -Werror=format-security Reject potentially unsafe format string arguents +# -Wp,-D_FORTIFY_SOURCE=2 Run-time buffer overflow detection +# -fPIC No text relocations +ARG NGX_CFLAGS="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC" +ENV NGX_CFLAGS=$NGX_CFLAGS +# References +# - https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc +# - https://wiki.debian.org/ToolChain/DSOLinking#Unresolved_symbols_in_shared_libraries +# - https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html +# - https://linux.die.net/man/1/ld +# -Wl,-rpath,/usr/local/lib Add a directory to the runtime library search path +# -Wl,-z,relro Read-only segments after relocation +# -Wl,-z,now Disable lazy binding +# -Wl,--as-needed Only link with needed libraries +# -pie Full ASLR for executables +ARG NGX_LDOPT="-Wl,-rpath,/usr/local/lib -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie" +ENV NGX_LDOPT=$NGX_LDOPT +# Reference: http://nginx.org/en/docs/configure.html +ARG NGINX_BUILD_CONFIG="\ + --prefix=/etc/nginx \ + --sbin-path=/usr/sbin/nginx \ + --modules-path=/usr/lib/nginx/modules \ + --conf-path=/etc/nginx/nginx.conf \ + --error-log-path=/var/log/nginx/error.log \ + --http-log-path=/var/log/nginx/access.log \ + --pid-path=/var/run/nginx.pid \ + --lock-path=/var/run/nginx.lock \ + --http-client-body-temp-path=/var/cache/nginx/client_temp \ + --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ + --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ + --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ + --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ + --with-perl_modules_path=/usr/lib/perl5/vendor_perl \ + --user=nginx \ + --group=nginx \ + --with-compat \ + --with-file-aio \ + --with-threads \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_mp4_module \ + --with-http_random_index_module \ + --with-http_realip_module \ + --with-http_secure_link_module \ + --with-http_slice_module \ + --with-http_ssl_module \ + --with-http_stub_status_module \ + --with-http_sub_module \ + --with-http_v2_module \ + --with-mail \ + --with-mail_ssl_module \ + --with-stream \ + --with-stream_realip_module \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --add-module=/lua-nginx-module-${VER_LUA_NGINX_MODULE} \ + --add-module=/ngx_devel_kit-${VER_NGX_DEVEL_KIT} \ + --add-module=/lua-upstream-nginx-module-${VER_LUA_UPSTREAM} \ + --add-module=/headers-more-nginx-module-${VER_OPENRESTY_HEADERS} \ + --add-module=/stream-lua-nginx-module-${VER_OPENRESTY_STREAMLUA} \ +" +ENV NGINX_BUILD_CONFIG=$NGINX_BUILD_CONFIG + +ARG BUILD_DEPS_BASE="\ + curl \ + geoip-dev \ + gzip \ + make \ + openssl-dev \ + patch \ + pcre-dev \ + tar \ + zlib-dev \ +" +ENV BUILD_DEPS_BASE=$BUILD_DEPS_BASE +ARG BUILD_DEPS_AMD64="\ + ${BUILD_DEPS_BASE} \ + g++ \ +" +ENV BUILD_DEPS_AMD64=$BUILD_DEPS_AMD64 +ARG BUILD_DEPS_ARM64V8="\ + ${BUILD_DEPS_BASE} \ + gcc-aarch64-none-elf \ +" +ENV BUILD_DEPS_ARM64V8=$BUILD_DEPS_ARM64V8 +ENV BUILD_DEPS= + +ARG NGINX_BUILD_DEPS="\ +# NGINX + alpine-sdk \ + bash \ + findutils \ + gd-dev \ + libedit-dev \ + libxslt-dev \ + linux-headers \ + perl-dev \ +" +ENV NGINX_BUILD_DEPS=$NGINX_BUILD_DEPS + +#################################### +# Build Nginx with support for LUA # +#################################### +FROM base AS builder + +# hadolint ignore=SC2086 +RUN set -eux \ + && eval BUILD_DEPS="\$$(echo BUILD_DEPS_${ARCH} | tr '[:lower:]' '[:upper:]')" \ + && apk update \ + && apk add --no-cache \ + $BUILD_DEPS \ + $NGINX_BUILD_DEPS + +COPY tpl/Makefile Makefile + +RUN make deps \ + && make lua-src \ + && make core \ + && make luarocks + +########################################## +# Combine everything with minimal layers # +########################################## +FROM base + +# http://label-schema.org/rc1/ +LABEL maintainer="Fabio Cicerchia " \ + org.label-schema.build-date="${BUILD_DATE}" \ + org.label-schema.description="Nginx ${VER_NGINX} with Lua support based on ${DOCKER_IMAGE_OS} ${DOCKER_IMAGE_TAG}." \ + org.label-schema.docker.cmd="docker run -p 80:80 -d ${DOCKER_IMAGE}:${VER_NGINX}-${DOCKER_IMAGE_OS}${DOCKER_IMAGE_TAG}" \ + org.label-schema.name="${DOCKER_IMAGE}" \ + org.label-schema.schema-version="1.0" \ + org.label-schema.url="https://github.com/${DOCKER_IMAGE}" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url="https://github.com/${DOCKER_IMAGE}" \ + org.label-schema.version="${VER_NGINX}-${DOCKER_IMAGE_OS}${DOCKER_IMAGE_TAG}" \ + image.target.platform="${TARGETPLATFORM}" \ + image.target.os="${TARGETOS}" \ + image.target.arch="${ARCH}" \ + versions.headers-more-nginx-module="${VER_OPENRESTY_HEADERS}" \ + versions.lua="${VER_LUA}" \ + versions.luarocks="${VER_LUAROCKS}" \ + versions.lua-nginx-module="${VER_LUA_NGINX_MODULE}" \ + versions.lua-resty-cookie="${VER_CLOUDFLARE_COOKIE}" \ + versions.lua-resty-core="${VER_LUA_RESTY_CORE}" \ + versions.lua-resty-dns="${VER_OPENRESTY_DNS}" \ + versions.lua-resty-lrucache="${VER_LUA_RESTY_LRUCACHE}" \ + versions.lua-resty-memcached="${VER_OPENRESTY_MEMCACHED}" \ + versions.lua-resty-mysql="${VER_OPENRESTY_MYSQL}" \ + versions.lua-resty-redis="${VER_OPENRESTY_REDIS}" \ + versions.lua-resty-shell="${VER_OPENRESTY_SHELL}" \ + versions.lua-resty-signal="${VER_OPENRESTY_SIGNAL}" \ + versions.lua-resty-tablepool="${VER_OPENRESTY_TABLEPOOL}" \ + versions.lua-resty-upstream-healthcheck="${VER_OPENRESTY_HEALTHCHECK}" \ + versions.lua-resty-websocket="${VER_OPENRESTY_WEBSOCKET}" \ + versions.lua-upstream="${VER_LUA_UPSTREAM}" \ + versions.luajit2="${VER_LUAJIT}" \ + versions.nginx-lua-prometheus="${VER_PROMETHEUS}" \ + versions.nginx="${VER_NGINX}" \ + versions.ngx_devel_kit="${VER_NGX_DEVEL_KIT}" \ + versions.os="${DOCKER_IMAGE_TAG}" \ + versions.stream-lua-nginx-module="${VER_OPENRESTY_STREAMLUA}" + +ARG PKG_DEPS="\ + geoip-dev \ + openssl-dev \ + pcre-dev \ + unzip \ + zlib-dev \ +" +ENV PKG_DEPS=$PKG_DEPS + +COPY --from=builder --chown=101:101 /etc/nginx /etc/nginx +COPY --from=builder --chown=101:101 /usr/local/lib /usr/local/lib +COPY --from=builder --chown=101:101 /usr/local/share/lua /usr/local/share/lua +COPY --from=builder --chown=101:101 /usr/sbin/nginx /usr/sbin/nginx +COPY --from=builder --chown=101:101 /usr/sbin/nginx-debug /usr/sbin/nginx-debug +COPY --from=builder --chown=101:101 /var/cache/nginx /var/cache/nginx +COPY --from=builder --chown=101:101 /usr/local/bin/lua /usr/local/bin/lua +COPY --from=builder --chown=101:101 /usr/local/bin/luajit /usr/local/bin/luajit +COPY --from=builder --chown=101:101 /usr/local/bin/luarocks /usr/local/bin/luarocks +COPY --from=builder --chown=101:101 /usr/local/etc/luarocks /usr/local/etc/luarocks +COPY --from=builder --chown=101:101 $LUAJIT_INC $LUAJIT_INC + +COPY --chown=101:101 tpl/support.sh / +COPY --chown=101:101 tpl/docker-entrypoint.sh / +COPY --chown=101:101 tpl/10-listen-on-ipv6-by-default.sh /docker-entrypoint.d/ +COPY --chown=101:101 tpl/20-envsubst-on-templates.sh /docker-entrypoint.d/ +COPY --chown=101:101 tpl/nginx.conf /etc/nginx/nginx.conf +COPY --chown=101:101 tpl/default.conf /etc/nginx/conf.d/default.conf + +SHELL ["/bin/ash", "-eo", "pipefail", "-c"] + +# hadolint ignore=SC2086 +RUN set -eux \ + && apk update \ + && apk add --no-cache --virtual .pkg_deps \ + $PKG_DEPS \ +# 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 --virtual .run_deps $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 --virtual pkg_tz tzdata \ +# Bring in curl and ca-certificates to make registering on DNS SD easier + && apk add --no-cache --virtual pkg_dns curl ca-certificates \ +# forward request and error logs to docker log collector + && mkdir -p /var/log/nginx \ + && ln -sf /dev/stdout /var/log/nginx/access.log \ + && ln -sf /dev/stderr /var/log/nginx/error.log \ +# 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 \ +# Upgrade software to latest version +# ############################################################################## + && apk upgrade + +# smoke test +# ############################################################################## +RUN envsubst -V \ + && nginx -V \ + && nginx -t \ + && lua -v \ + && luarocks --version + +EXPOSE 80 443 + +HEALTHCHECK --interval=30s --timeout=3s CMD curl --fail http://localhost/ || exit 1 + +# Override stop signal to stop process gracefully +STOPSIGNAL SIGQUIT + +ENTRYPOINT ["/docker-entrypoint.sh"] + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx/1.21.6/alpine/3.16.0/tpl/10-listen-on-ipv6-by-default.sh b/nginx/1.21.6/alpine/3.16.0/tpl/10-listen-on-ipv6-by-default.sh new file mode 100755 index 00000000..cd5190db --- /dev/null +++ b/nginx/1.21.6/alpine/3.16.0/tpl/10-listen-on-ipv6-by-default.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# vim:sw=4:ts=4:et + +set -e + +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 + echo >&3 "$ME: error: ipv6 not available" + exit 0 +fi + +if [ ! -f "/$DEFAULT_CONF_FILE" ]; then + echo >&3 "$ME: error: /$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 || { echo >&3 "$ME: error: 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 && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; } + +if [ -f "/etc/os-release" ]; then + . /etc/os-release +else + echo >&3 "$ME: error: can not guess the operating system" + exit 0 +fi + +echo >&3 "$ME: 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 || { +# echo >&3 "$ME: error: /$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 || { +# echo >&3 "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version" +# exit 0 +# } +# ;; +# *) +# echo >&3 "$ME: error: 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 + +echo >&3 "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE" + +exit 0 diff --git a/nginx/1.21.6/alpine/3.16.0/tpl/20-envsubst-on-templates.sh b/nginx/1.21.6/alpine/3.16.0/tpl/20-envsubst-on-templates.sh new file mode 100755 index 00000000..4f330295 --- /dev/null +++ b/nginx/1.21.6/alpine/3.16.0/tpl/20-envsubst-on-templates.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +set -e + +ME=$(basename $0) + +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 template defined_envs relative_path output_path subdir + defined_envs=$(printf '${%s} ' $(env | cut -d= -f1)) + [ -d "$template_dir" ] || return 0 + if [ ! -w "$output_dir" ]; then + echo >&3 "$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" + echo >&3 "$ME: Running envsubst on $template to $output_path" + envsubst "$defined_envs" < "$template" > "$output_path" + done +} + +auto_envsubst + +exit 0 diff --git a/nginx/1.21.6/alpine/3.16.0/tpl/Makefile b/nginx/1.21.6/alpine/3.16.0/tpl/Makefile new file mode 100644 index 00000000..b7f7d50f --- /dev/null +++ b/nginx/1.21.6/alpine/3.16.0/tpl/Makefile @@ -0,0 +1,242 @@ +# __ __ +# .-----.-----.|__|.-----.--.--.______| |.--.--.---.-. +# | | _ || || |_ _|______| || | | _ | +# |__|__|___ ||__||__|__|__.__| |__||_____|___._| +# |_____| +# +# Copyright (c) 2022 Fabio Cicerchia. https://fabiocicerchia.it. MIT License +# Repo: https://github.com/fabiocicerchia/nginx-lua + +EXTENDED_IMAGE=YES +NPROC := $(shell nproc) + +# ############################################################################## +# CORE +# ############################################################################## + +core: +# NGINX +# ############################################################################## +# we're on an architecture upstream doesn't officially build for +# let's build binaries from the published packaging sources +# TODO: need to get all patches from openresty? +# TODO: Find a better way to fallback when openresty is behind the nginx latest version and no patch is available + curl -sLo /nginx.tar.gz https://nginx.org/download/nginx-${VER_NGINX}.tar.gz + tar -C / -xvzf /nginx.tar.gz + mkdir -p /var/cache/nginx/client_temp \ + /var/cache/nginx/proxy_temp \ + /var/cache/nginx/fastcgi_temp \ + /var/cache/nginx/uwsgi_temp \ + /var/cache/nginx/scgi_temp + cd /nginx-${VER_NGINX} \ + && (curl --fail -sLo nginx-socket_cloexec.patch https://raw.githubusercontent.com/openresty/openresty/master/patches/nginx-${VER_NGINX}-socket_cloexec.patch || \ + curl -sLo nginx-socket_cloexec.patch https://raw.githubusercontent.com/openresty/openresty/master/patches/nginx-1.21.4-socket_cloexec.patch) \ + && patch -p1 < nginx-socket_cloexec.patch || exit 1 \ + && ./configure ${NGINX_BUILD_CONFIG} --with-cc-opt="$(NGX_CFLAGS)" --with-ld-opt="$(NGX_LDOPT)" --with-debug \ + && make -j $(NPROC) build \ + && mv objs/nginx objs/nginx-debug \ + && ./configure ${NGINX_BUILD_CONFIG} --with-cc-opt="$(NGX_CFLAGS)" --with-ld-opt="$(NGX_LDOPT)" \ + && make -j $(NPROC) build \ + && make -j $(NPROC) modules \ + && install -m755 objs/nginx-debug /usr/sbin/nginx-debug \ + && make -j $(NPROC) install + +# ############################################################################## +# DEPENDENCIES +# ############################################################################## + +deps: dep-ngx_devel_kit dep-luajit dep-lua-nginx dep-lua-resty-core dep-lua-resty-lrucache +ifeq ($(EXTENDED_IMAGE), YES) + make dep-headers-more-nginx-module dep-lua-resty-cookie dep-lua-openresty-dns dep-lua-openresty-memcached dep-lua-openresty-mysql dep-lua-openresty-redis dep-lua-openresty-shell dep-lua-openresty-tablepool dep-lua-openresty-signal dep-lua-resty-upstream-healthcheck dep-lua-openresty-websocket dep-lua-upstream-nginx-module dep-nginx-lua-prometheus dep-stream-lua-nginx-module +endif + +# NGX Devel Kit +# ############################################################################## +dep-ngx_devel_kit: + curl -sLo /ngx_devel_kit.tar.gz https://github.com/vision5/ngx_devel_kit/archive/v${VER_NGX_DEVEL_KIT}.tar.gz + tar -C / -xvzf /ngx_devel_kit.tar.gz + +# OpenResty LUAJIT2 +# ############################################################################## +# This is because OpenResty LuaJIT2 is stuck on Lua 5.1 since 2009. +# Also, since LUA_LIB_DIR is set on 5.4, the 5.1 folder is always empty and nginx +# will try to look things in the wrong one, unless provided with: +# lua_package_path '/usr/local/share/lua/5.4/?.lua;;'; +# lua_package_cpath '/usr/local/lib/lua/5.4/?.so;;'; +.workaround-luajit: + ln -s /usr/local/lib/lua/5.4 /usr/local/lib/lua/5.1 + ln -s /usr/local/share/lua/5.4 /usr/local/share/lua/5.1 + +dep-luajit: .workaround-luajit + curl -sLo /luajit.tar.gz https://github.com/openresty/luajit2/archive/v${VER_LUAJIT}.tar.gz + tar -C / -xvzf /luajit.tar.gz + cd /luajit2-${VER_LUAJIT} \ + && make \ + && make install + +# Lua Nginx Module +# ############################################################################## +dep-lua-nginx: + curl -sLo /lua-nginx.tar.gz https://github.com/openresty/lua-nginx-module/archive/v${VER_LUA_NGINX_MODULE}.tar.gz + tar -C / -xvzf /lua-nginx.tar.gz + +# LUA Resty Core +# ############################################################################## +dep-lua-resty-core: + curl -sLo /lua-resty-core.tar.gz https://github.com/openresty/lua-resty-core/archive/v${VER_LUA_RESTY_CORE}.tar.gz + tar -C / -xvzf /lua-resty-core.tar.gz + cd /lua-resty-core-${VER_LUA_RESTY_CORE} \ + && make \ + && make install + +# LUA Resty LRUCache +# ############################################################################## +dep-lua-resty-lrucache: + curl -sLo /lua-resty-lrucache.tar.gz https://github.com/openresty/lua-resty-lrucache/archive/v${VER_LUA_RESTY_LRUCACHE}.tar.gz + tar -C / -xvzf /lua-resty-lrucache.tar.gz + cd /lua-resty-lrucache-${VER_LUA_RESTY_LRUCACHE} \ + && make \ + && make install + +# OpenResty Headers +# ############################################################################## +dep-headers-more-nginx-module: + curl -sLo /headers-more-nginx-module.zip https://github.com/openresty/headers-more-nginx-module/archive/${VER_OPENRESTY_HEADERS}.zip + unzip -d / /headers-more-nginx-module.zip + +# Cloudflare Cookie +# ############################################################################## +dep-lua-resty-cookie: + curl -sLo /lua-resty-cookie.tar.gz https://github.com/cloudflare/lua-resty-cookie/archive/${VER_CLOUDFLARE_COOKIE}.tar.gz + tar -C / -xvzf /lua-resty-cookie.tar.gz + cd /lua-resty-cookie-${VER_CLOUDFLARE_COOKIE} \ + && make \ + && make install + +# OpenResty Dns +# ############################################################################## +dep-lua-openresty-dns: + curl -sLo /lua-openresty-dns.tar.gz https://github.com/openresty/lua-resty-dns/archive/v${VER_OPENRESTY_DNS}.tar.gz + tar -C / -xvzf /lua-openresty-dns.tar.gz + cd /lua-resty-dns-${VER_OPENRESTY_DNS} \ + && make \ + && make install + +# OpenResty Memcached +# ############################################################################## +dep-lua-openresty-memcached: + curl -sLo /lua-openresty-memcached.tar.gz https://github.com/openresty/lua-resty-memcached/archive/v${VER_OPENRESTY_MEMCACHED}.tar.gz + tar -C / -xvzf /lua-openresty-memcached.tar.gz + cd /lua-resty-memcached-${VER_OPENRESTY_MEMCACHED} \ + && make \ + && make install + +# OpenResty Mysql +# ############################################################################## +dep-lua-openresty-mysql: + curl -sLo /lua-openresty-mysql.tar.gz https://github.com/openresty/lua-resty-mysql/archive/v${VER_OPENRESTY_MYSQL}.tar.gz + tar -C / -xvzf /lua-openresty-mysql.tar.gz + cd /lua-resty-mysql-${VER_OPENRESTY_MYSQL} \ + && make \ + && make install + +# OpenResty Redis +# ############################################################################## +dep-lua-openresty-redis: + curl -sLo /lua-openresty-redis.tar.gz https://github.com/openresty/lua-resty-redis/archive/v${VER_OPENRESTY_REDIS}.tar.gz + tar -C / -xvzf /lua-openresty-redis.tar.gz + cd /lua-resty-redis-${VER_OPENRESTY_REDIS} \ + && make \ + && make install + +# OpenResty Shell +# ############################################################################## +dep-lua-openresty-shell: + curl -sLo /lua-openresty-shell.tar.gz https://github.com/openresty/lua-resty-shell/archive/v${VER_OPENRESTY_SHELL}.tar.gz + tar -C / -xvzf /lua-openresty-shell.tar.gz + cd /lua-resty-shell-${VER_OPENRESTY_SHELL} \ + && make \ + && make install + +# OpenResty Tablepool +# ############################################################################## +dep-lua-openresty-tablepool: + curl -sLo /lua-tablepool.tar.gz https://github.com/openresty/lua-tablepool/archive/refs/tags/v${VER_OPENRESTY_TABLEPOOL}.tar.gz + tar -C / -xvzf /lua-tablepool.tar.gz + cd /lua-tablepool-${VER_OPENRESTY_TABLEPOOL} \ + && make \ + && make install + +# OpenResty Signal +# ############################################################################## +dep-lua-openresty-signal: + curl -sLo /lua-openresty-signal.tar.gz https://github.com/openresty/lua-resty-signal/archive/refs/tags/v${VER_OPENRESTY_SIGNAL}.tar.gz + tar -C / -xvzf /lua-openresty-signal.tar.gz + cd /lua-resty-signal-${VER_OPENRESTY_SIGNAL} \ + && make \ + && make install \ + && install -d /usr/local/lib/lua/5.4 \ + && install /usr/local/share/lua/5.4/librestysignal.so /usr/local/lib/lua/5.4/librestysignal.so + +# OpenResty Upstream Healthcheck +# ############################################################################## +dep-lua-resty-upstream-healthcheck: + curl -sLo /lua-resty-upstream-healthcheck.tar.gz https://github.com/openresty/lua-resty-upstream-healthcheck/archive/v${VER_OPENRESTY_HEALTHCHECK}.tar.gz + tar -C / -xvzf /lua-resty-upstream-healthcheck.tar.gz + cd /lua-resty-upstream-healthcheck-${VER_OPENRESTY_HEALTHCHECK} \ + && make \ + && make install + +# OpenResty Websocket +# ############################################################################## +dep-lua-openresty-websocket: + curl -sLo /lua-openresty-websocket.tar.gz https://github.com/openresty/lua-resty-websocket/archive/v${VER_OPENRESTY_WEBSOCKET}.tar.gz + tar -C / -xvzf /lua-openresty-websocket.tar.gz + cd /lua-resty-websocket-${VER_OPENRESTY_WEBSOCKET} \ + && make \ + && make install + +# LUA Upstream +# ############################################################################## +dep-lua-upstream-nginx-module: + curl -sLo /lua-upstream-nginx-module.tar.gz https://github.com/openresty/lua-upstream-nginx-module/archive/v${VER_LUA_UPSTREAM}.tar.gz + tar -C / -xvzf /lua-upstream-nginx-module.tar.gz + +# Prometheus +# ############################################################################## +dep-nginx-lua-prometheus: + curl -sLo /nginx-lua-prometheus.tar.gz https://github.com/knyar/nginx-lua-prometheus/archive/${VER_PROMETHEUS}.tar.gz + tar -C / -xvzf /nginx-lua-prometheus.tar.gz + mv /nginx-lua-prometheus-${VER_PROMETHEUS}/*.lua ${LUA_LIB_DIR}/ + +# OpenResty Stream Lua +# ############################################################################## +dep-stream-lua-nginx-module: + curl -sLo /stream-lua-nginx-module.zip https://github.com/openresty/stream-lua-nginx-module/archive/v${VER_OPENRESTY_STREAMLUA}.zip + unzip -d / /stream-lua-nginx-module.zip + +# ############################################################################## +# LUAROCKS +# ############################################################################## + +luarocks: + curl -sLo /luarocks.tar.gz https://luarocks.org/releases/luarocks-${VER_LUAROCKS}.tar.gz + tar -C / -xzvf /luarocks.tar.gz + cd /luarocks-${VER_LUAROCKS}; \ + ./configure \ + && make \ + && make install + +################################################################################ +##@ COMPILE LUA +################################################################################ + +lua-src: + curl -sLo /luasrc.tar.gz http://www.lua.org/ftp/lua-${VER_LUA}.tar.gz + tar -C / -xzvf /luasrc.tar.gz + cd /lua-$${VER_LUA}; \ + sed -i "s/DLUA_COMPAT_5_3/DLUA_COMPAT_5_1/" src/Makefile \ + && sed -i "s/DLUA_COMPAT_5_2/DLUA_COMPAT_5_1/" src/Makefile \ + && make linux test \ + && make install \ + && cp /lua-$${VER_LUA}/src/*.h /usr/include/ diff --git a/nginx/1.21.6/alpine/3.16.0/tpl/default.conf b/nginx/1.21.6/alpine/3.16.0/tpl/default.conf new file mode 100644 index 00000000..4559b82f --- /dev/null +++ b/nginx/1.21.6/alpine/3.16.0/tpl/default.conf @@ -0,0 +1,44 @@ +server { + listen 80; + server_name localhost; + + #charset koi8-r; + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} diff --git a/nginx/1.21.6/alpine/3.16.0/tpl/docker-entrypoint.sh b/nginx/1.21.6/alpine/3.16.0/tpl/docker-entrypoint.sh new file mode 100755 index 00000000..501839b7 --- /dev/null +++ b/nginx/1.21.6/alpine/3.16.0/tpl/docker-entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# vim:sw=4:ts=4:et + +/support.sh + +set -e + +if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then + exec 3>&1 +else + exec 3>/dev/null +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 + echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration" + + echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/" + find "/docker-entrypoint.d/" -follow -type f -print | sort -n | while read -r f; do + case "$f" in + *.sh) + if [ -x "$f" ]; then + echo >&3 "$0: Launching $f"; + "$f" + else + # warn on shell scripts without exec bit + echo >&3 "$0: Ignoring $f, not executable"; + fi + ;; + *) echo >&3 "$0: Ignoring $f";; + esac + done + + echo >&3 "$0: Configuration complete; ready for start up" + else + echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration" + fi +fi + +exec "$@" diff --git a/nginx/1.21.6/alpine/3.16.0/tpl/nginx.conf b/nginx/1.21.6/alpine/3.16.0/tpl/nginx.conf new file mode 100644 index 00000000..41d94b46 --- /dev/null +++ b/nginx/1.21.6/alpine/3.16.0/tpl/nginx.conf @@ -0,0 +1,31 @@ +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} diff --git a/nginx/1.21.6/alpine/3.16.0/tpl/support.sh b/nginx/1.21.6/alpine/3.16.0/tpl/support.sh new file mode 100755 index 00000000..e981196e --- /dev/null +++ b/nginx/1.21.6/alpine/3.16.0/tpl/support.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +echo "💗 Support the Project 💗" +echo "This project is only maintained by one person, Fabio Cicerchia ." +echo "It started as a simple docker image, now it updates automatically periodically and provides support for multiple disto 😎" +echo "Maintaining a project is a very time consuming activity, especially when done alone 💪" +echo "I really want to make this project better and become super cool 🚀" +echo "" +echo "If you'd like to support this open-source project I'll appreciate any kind of contribution ." +echo "" +echo "---" +echo "" + +# track execution runs +if [ "$SKIP_TRACK" != "1" ]; then + curl -m 5 "https://kodebeat.com/nginx-lua/stats/hit/boot.php?os=$DOCKER_IMAGE_OS&v=$VER_NGINX" +fi diff --git a/supported_versions b/supported_versions index c1355fd9..cf45753a 100644 --- a/supported_versions +++ b/supported_versions @@ -1,6 +1,6 @@ nginx=1.21.6 almalinux=8.6-20220512 -alpine=3.15.4 +alpine=3.16.0 amazonlinux=2.0.20220426.0 debian=11.3 fedora=36