Skip to content

Commit 272f82e

Browse files
authored
Update to version 1.16.0 and remove openssl (#2)
Update to version 1.16.0 and remove openssl
2 parents f953517 + cec915e commit 272f82e

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

Dockerfile

+28-17
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ FROM alpine:3.9
22

33
LABEL maintainer="NGINX Docker Maintainers <[email protected]>"
44

5-
ENV NGINX_VERSION 1.15.12
5+
ENV NGINX_VERSION 1.16.0
66

77
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
8+
# Nginx Build Config
89
&& CONFIG="\
9-
--add-module=../ngx_brotli \
10-
--with-openssl=../openssl-1.1.1b \
10+
--add-module=/usr/src/ngx_brotli \
1111
--prefix=/etc/nginx \
1212
--sbin-path=/usr/sbin/nginx \
1313
--modules-path=/usr/lib/nginx/modules \
@@ -52,8 +52,10 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
5252
--with-file-aio \
5353
--with-http_v2_module \
5454
" \
55+
# Nginx will be run under user nginx:nginx
5556
&& addgroup -S nginx \
5657
&& adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
58+
# Installing build dependencies
5759
&& apk add --no-cache --virtual .build-deps \
5860
gcc \
5961
libc-dev \
@@ -67,10 +69,19 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
6769
libxslt-dev \
6870
gd-dev \
6971
geoip-dev \
72+
&& apk add --no-cache --virtual .brotli-build-deps \
73+
autoconf \
74+
libtool \
75+
automake \
7076
git \
77+
g++ \
78+
cmake \
79+
&& mkdir -p /usr/src \
80+
&& cd /usr/src \
81+
&& echo "Downloading Nginx" \
7182
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
7283
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
73-
&& curl -fSL https://www.openssl.org/source/openssl-1.1.1b.tar.gz -o openssl-1.1.1b.tar.gz \
84+
# Verifying Nginx
7485
&& export GNUPGHOME="$(mktemp -d)" \
7586
&& found=''; \
7687
for server in \
@@ -85,15 +96,14 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
8596
test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \
8697
gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
8798
&& rm -rf "$GNUPGHOME" nginx.tar.gz.asc \
88-
&& mkdir -p /usr/src \
8999
&& tar -zxC /usr/src -f nginx.tar.gz \
90-
&& tar -zxC /usr/src -f openssl-1.1.1b.tar.gz \
91100
&& rm -f nginx.tar.gz \
92-
&& rm -f openssl-1.1.1b.tar.gz \
101+
# Downloading Brotli
102+
&& echo "Downloading Brotli" \
93103
&& cd /usr/src \
94-
&& git clone https://github.com/google/ngx_brotli.git \
95-
&& cd ngx_brotli \
96-
&& git submodule update --init \
104+
&& git clone --recursive https://github.com/google/ngx_brotli.git \
105+
# Building Nginx
106+
&& echo "Building Nginx" \
97107
&& cd /usr/src/nginx-$NGINX_VERSION \
98108
&& ./configure $CONFIG --with-debug \
99109
&& make -j$(getconf _NPROCESSORS_ONLN) \
@@ -119,7 +129,6 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
119129
&& strip /usr/sbin/nginx* \
120130
&& strip /usr/lib/nginx/modules/*.so \
121131
&& rm -rf /usr/src/nginx-$NGINX_VERSION \
122-
&& rm -rf /usr/src/openssl-1.1.1b \
123132
&& rm -rf /usr/src/ngx_brotli \
124133
\
125134
# Bring in gettext so we can get `envsubst`, then throw
@@ -129,14 +138,16 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
129138
&& apk add --no-cache --virtual .gettext gettext \
130139
&& mv /usr/bin/envsubst /tmp/ \
131140
\
132-
&& runDeps="$( \
133-
scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
134-
| tr ',' '\n' \
141+
&& runDeps="$( \
142+
scanelf --needed --nobanner /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
143+
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
144+
| sort -u \
145+
| xargs -r apk info --installed \
135146
| sort -u \
136-
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
137147
)" \
138148
&& apk add --no-cache --virtual .nginx-rundeps $runDeps \
139149
&& apk del .build-deps \
150+
&& apk del .brotli-build-deps \
140151
&& apk del .gettext \
141152
&& mv /tmp/envsubst /usr/local/bin/ \
142153
\
@@ -151,8 +162,8 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
151162
COPY nginx.conf /etc/nginx/nginx.conf
152163
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
153164

154-
EXPOSE 80
165+
EXPOSE 80 443
155166

156167
STOPSIGNAL SIGTERM
157168

158-
CMD ["nginx", "-g", "daemon off;"]
169+
CMD ["nginx", "-g", "daemon off;"]

nginx.conf

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ http {
2525

2626
keepalive_timeout 65;
2727

28-
#gzip on;
28+
gzip on;
29+
30+
brotli on;
31+
brotli_static on;
2932

3033
include /etc/nginx/conf.d/*.conf;
31-
}
34+
}

0 commit comments

Comments
 (0)