1- FROM alpine:edge as builder
1+ FROM alpine:3.10 as builder
22
33LABEL maintainer="metowolf <i@i-meto.com>"
44
5- ARG NGINX_VERSION=1.17.3
6- ARG OPENSSL_VERSION=1.1.1c
5+ ARG NGINX_VERSION=1.17.4
6+ ARG OPENSSL_VERSION=1.1.1d
77
88RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
9- && CONFIG="\
10- --prefix=/etc/nginx \
11- --sbin-path=/usr/sbin/nginx \
12- --modules-path=/usr/lib/nginx/modules \
13- --conf-path=/etc/nginx/nginx.conf \
14- --error-log-path=/var/log/nginx/error.log \
15- --http-log-path=/var/log/nginx/access.log \
16- --pid-path=/var/run/nginx.pid \
17- --lock-path=/var/run/nginx.lock \
18- --http-client-body-temp-path=/var/cache/nginx/client_temp \
19- --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
20- --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
21- --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
22- --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
23- --user=nginx \
24- --group=nginx \
25- --with-http_ssl_module \
26- --with-http_realip_module \
27- --with-http_addition_module \
28- --with-http_sub_module \
29- --with-http_dav_module \
30- --with-http_flv_module \
31- --with-http_mp4_module \
32- --with-http_gunzip_module \
33- --with-http_gzip_static_module \
34- --with-http_random_index_module \
35- --with-http_secure_link_module \
36- --with-http_stub_status_module \
37- --with-http_auth_request_module \
38- --with-http_xslt_module=dynamic \
39- --with-http_image_filter_module=dynamic \
40- --with-http_geoip_module=dynamic \
41- --with-threads \
42- --with-stream \
43- --with-stream_ssl_module \
44- --with-stream_ssl_preread_module \
45- --with-stream_realip_module \
46- --with-stream_geoip_module=dynamic \
47- --with-http_slice_module \
48- --with-mail \
49- --with-mail_ssl_module \
50- --with-compat \
51- --with-file-aio \
52- --with-http_v2_module \
53- " \
54- && addgroup -S nginx \
55- && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
56- && apk add --no-cache \
57- gcc \
58- libc-dev \
59- make \
60- openssl-dev \
61- pcre-dev \
62- zlib-dev \
63- linux-headers \
64- curl \
65- gnupg \
66- libxslt-dev \
67- gd-dev \
68- geoip-dev \
69- git \
70- gettext \
71- && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
72- && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
73- && export GNUPGHOME="$(mktemp -d)" ; \
74- for key in $GPG_KEYS; do \
75- gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
76- done \
77- && gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
78- && mkdir -p /usr/src \
79- && tar -zxC /usr/src -f nginx.tar.gz \
80- && rm nginx.tar.gz \
81- && cd /usr/src/nginx-$NGINX_VERSION \
82- \
83- # Brotli
84- && git clone https://github.com/eustas/ngx_brotli.git --depth=1 \
85- && (cd ngx_brotli; git submodule update --init) \
86- \
87- # cf-zlib
88- && git clone https://github.com/cloudflare/zlib.git --depth 1 \
89- && (cd zlib; make -f Makefile.in distclean) \
90- \
91- # OpenSSL
92- && curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz \
93- && tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
94- \
95- # Sticky
96- && mkdir nginx-sticky-module-ng \
97- && curl -fSL https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/master.tar.gz -o nginx-sticky-module-ng.tar.gz \
98- && tar -zxC nginx-sticky-module-ng -f nginx-sticky-module-ng.tar.gz --strip 1 \
99- \
100- # headers-more-nginx
101- && git clone https://github.com/openresty/headers-more-nginx-module.git --depth 1 \
102- \
103- && CONFIG="$CONFIG \
104- --with-zlib=/usr/src/nginx-${NGINX_VERSION}/zlib \
105- --add-dynamic-module=/usr/src/nginx-${NGINX_VERSION}/ngx_brotli \
106- --add-dynamic-module=/usr/src/nginx-${NGINX_VERSION}/nginx-sticky-module-ng \
107- --add-dynamic-module=/usr/src/nginx-${NGINX_VERSION}/headers-more-nginx-module \
108- --with-openssl=/usr/src/nginx-${NGINX_VERSION}/openssl-${OPENSSL_VERSION} \
109- " \
110- && ./configure $CONFIG \
111- && make -j$(getconf _NPROCESSORS_ONLN) \
112- && make install \
113- && rm -rf /etc/nginx/html/ \
114- && mkdir /etc/nginx/conf.d/ \
115- && mkdir -p /usr/share/nginx/html/ \
116- && install -m644 html/index.html /usr/share/nginx/html/ \
117- && install -m644 html/50x.html /usr/share/nginx/html/ \
118- && ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \
119- && strip /usr/sbin/nginx* \
120- && strip /usr/lib/nginx/modules/*.so \
121- && nginx -V
9+ && CONFIG="\
10+ --prefix=/etc/nginx \
11+ --sbin-path=/usr/sbin/nginx \
12+ --modules-path=/usr/lib/nginx/modules \
13+ --conf-path=/etc/nginx/nginx.conf \
14+ --error-log-path=/var/log/nginx/error.log \
15+ --http-log-path=/var/log/nginx/access.log \
16+ --pid-path=/var/run/nginx.pid \
17+ --lock-path=/var/run/nginx.lock \
18+ --http-client-body-temp-path=/var/cache/nginx/client_temp \
19+ --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
20+ --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
21+ --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
22+ --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
23+ --user=nginx \
24+ --group=nginx \
25+ --with-http_ssl_module \
26+ --with-http_realip_module \
27+ --with-http_addition_module \
28+ --with-http_sub_module \
29+ --with-http_dav_module \
30+ --with-http_flv_module \
31+ --with-http_mp4_module \
32+ --with-http_gunzip_module \
33+ --with-http_gzip_static_module \
34+ --with-http_random_index_module \
35+ --with-http_secure_link_module \
36+ --with-http_stub_status_module \
37+ --with-http_auth_request_module \
38+ --with-http_xslt_module=dynamic \
39+ --with-http_image_filter_module=dynamic \
40+ --with-http_geoip_module=dynamic \
41+ --with-threads \
42+ --with-stream \
43+ --with-stream_ssl_module \
44+ --with-stream_ssl_preread_module \
45+ --with-stream_realip_module \
46+ --with-stream_geoip_module=dynamic \
47+ --with-http_slice_module \
48+ --with-mail \
49+ --with-mail_ssl_module \
50+ --with-compat \
51+ --with-file-aio \
52+ --with-http_v2_module \
53+ " \
54+ && addgroup -S nginx \
55+ && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
56+ && apk upgrade \
57+ && apk add --no-cache \
58+ gcc \
59+ libc-dev \
60+ make \
61+ openssl-dev \
62+ pcre-dev \
63+ zlib-dev \
64+ linux-headers \
65+ curl \
66+ gnupg \
67+ libxslt-dev \
68+ gd-dev \
69+ geoip-dev \
70+ git \
71+ gettext \
72+ && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
73+ && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
74+ && export GNUPGHOME="$(mktemp -d)" ; \
75+ for key in $GPG_KEYS; do \
76+ gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
77+ done \
78+ && gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
79+ && mkdir -p /usr/src \
80+ && tar -zxC /usr/src -f nginx.tar.gz \
81+ && rm nginx.tar.gz \
82+ && cd /usr/src/nginx-$NGINX_VERSION \
83+ \
84+ # Brotli
85+ && git clone https://github.com/eustas/ngx_brotli.git --depth=1 \
86+ && (cd ngx_brotli; git submodule update --init) \
87+ \
88+ # cf-zlib
89+ && git clone https://github.com/cloudflare/zlib.git --depth 1 \
90+ && (cd zlib; make -f Makefile.in distclean) \
91+ \
92+ # OpenSSL
93+ && curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz \
94+ && tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
95+ \
96+ # Sticky
97+ && mkdir nginx-sticky-module-ng \
98+ && curl -fSL https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/master.tar.gz -o nginx-sticky-module-ng.tar.gz \
99+ && tar -zxC nginx-sticky-module-ng -f nginx-sticky-module-ng.tar.gz --strip 1 \
100+ \
101+ # headers-more-nginx
102+ && git clone https://github.com/openresty/headers-more-nginx-module.git --depth 1 \
103+ \
104+ && CONFIG="$CONFIG \
105+ --with-zlib=/usr/src/nginx-${NGINX_VERSION}/zlib \
106+ --add-dynamic-module=/usr/src/nginx-${NGINX_VERSION}/ngx_brotli \
107+ --add-dynamic-module=/usr/src/nginx-${NGINX_VERSION}/nginx-sticky-module-ng \
108+ --add-dynamic-module=/usr/src/nginx-${NGINX_VERSION}/headers-more-nginx-module \
109+ --with-openssl=/usr/src/nginx-${NGINX_VERSION}/openssl-${OPENSSL_VERSION} \
110+ " \
111+ && ./configure $CONFIG \
112+ && make -j$(getconf _NPROCESSORS_ONLN) \
113+ && make install \
114+ && rm -rf /etc/nginx/html/ \
115+ && mkdir /etc/nginx/conf.d/ \
116+ && mkdir -p /usr/share/nginx/html/ \
117+ && install -m644 html/index.html /usr/share/nginx/html/ \
118+ && install -m644 html/50x.html /usr/share/nginx/html/ \
119+ && ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \
120+ && strip /usr/sbin/nginx* \
121+ && strip /usr/lib/nginx/modules/*.so \
122+ && nginx -V
122123
123124COPY config/nginx.conf /etc/nginx/nginx.conf
124125COPY config/nginx.vh.default.conf /etc/nginx/conf.d/default.conf
@@ -134,23 +135,23 @@ COPY --from=builder /usr/lib/nginx/ /usr/lib/nginx/
134135COPY --from=builder /usr/share/nginx /usr/share/nginx
135136
136137RUN apk add --no-cache \
137- musl \
138- pcre \
139- libssl1.1 \
140- libcrypto1.1 \
141- zlib \
142- libintl \
143- tzdata \
144- logrotate \
145- && sed -i -e 's:/var/log/messages {}:# /var/log/messages {}:' /etc/logrotate.conf \
146- && echo '1 0 * * * /usr/sbin/logrotate /etc/logrotate.conf -f' > /var/spool/cron/crontabs/root \
147- && addgroup -S nginx \
148- && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
149- && mkdir -p /var/log/nginx \
150- && ln -sf /dev/stdout /var/log/nginx/access.log \
151- && ln -sf /dev/stderr /var/log/nginx/error.log \
152- && mv /etc/nginx/logrotate /etc/logrotate.d/nginx \
153- && chmod 755 /etc/logrotate.d/nginx
138+ musl \
139+ pcre \
140+ libssl1.1 \
141+ libcrypto1.1 \
142+ zlib \
143+ libintl \
144+ tzdata \
145+ logrotate \
146+ && sed -i -e 's:/var/log/messages {}:# /var/log/messages {}:' /etc/logrotate.conf \
147+ && echo '1 0 * * * /usr/sbin/logrotate /etc/logrotate.conf -f' > /var/spool/cron/crontabs/root \
148+ && addgroup -S nginx \
149+ && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
150+ && mkdir -p /var/log/nginx \
151+ && ln -sf /dev/stdout /var/log/nginx/access.log \
152+ && ln -sf /dev/stderr /var/log/nginx/error.log \
153+ && mv /etc/nginx/logrotate /etc/logrotate.d/nginx \
154+ && chmod 755 /etc/logrotate.d/nginx
154155
155156COPY docker-entrypoint.sh /usr/local/bin/
156157ENTRYPOINT ["docker-entrypoint.sh" ]
0 commit comments