From 81b150828135811cd298301265ca38bc67ae2907 Mon Sep 17 00:00:00 2001 From: db1234719 Date: Thu, 13 Nov 2025 16:43:21 +0000 Subject: [PATCH] a better and almost identical to the original version nginx alpine added as test for now... --- DockerfileTest | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 DockerfileTest diff --git a/DockerfileTest b/DockerfileTest new file mode 100644 index 0000000..33e2843 --- /dev/null +++ b/DockerfileTest @@ -0,0 +1,41 @@ +# --- Stage 1: build nginx --- +FROM alpine:3.22 AS builder + +ENV NGINX_VERSION=1.29.3 + +RUN apk add --no-cache \ + gcc make libc-dev pcre2-dev zlib-dev openssl-dev linux-headers curl gnupg tar + +WORKDIR /tmp +RUN curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \ + && tar -zxf nginx.tar.gz \ + && cd nginx-$NGINX_VERSION \ + && ./configure \ + --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 \ + --with-http_ssl_module \ + --with-http_v2_module \ + --with-http_gzip_static_module \ + && make && make install + +# --- Stage 2: runtime --- +FROM alpine:3.22 + +RUN apk add --no-cache pcre2 zlib openssl ca-certificates \ + && adduser -D -g 'nginx' nginx \ + && mkdir -p /var/cache/nginx /etc/nginx/conf.d /usr/share/nginx/html \ + && chown -R nginx:nginx /var/cache/nginx /var/run /etc/nginx /usr/share/nginx/html + +COPY --from=builder /usr/sbin/nginx /usr/sbin/nginx +COPY --from=builder /etc/nginx /etc/nginx +COPY --from=builder /usr/lib/nginx /usr/lib/nginx + +EXPOSE 80 +STOPSIGNAL SIGTERM +CMD ["nginx", "-g", "daemon off;"]