@@ -2,12 +2,12 @@ FROM alpine:3.9
2
2
3
3
LABEL maintainer=
"NGINX Docker Maintainers <[email protected] >"
4
4
5
- ENV NGINX_VERSION 1.15.12
5
+ ENV NGINX_VERSION 1.16.0
6
6
7
7
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
8
+ # Nginx Build Config
8
9
&& CONFIG="\
9
- --add-module=../ngx_brotli \
10
- --with-openssl=../openssl-1.1.1b \
10
+ --add-module=/usr/src/ngx_brotli \
11
11
--prefix=/etc/nginx \
12
12
--sbin-path=/usr/sbin/nginx \
13
13
--modules-path=/usr/lib/nginx/modules \
@@ -52,8 +52,10 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
52
52
--with-file-aio \
53
53
--with-http_v2_module \
54
54
" \
55
+ # Nginx will be run under user nginx:nginx
55
56
&& addgroup -S nginx \
56
57
&& adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
58
+ # Installing build dependencies
57
59
&& apk add --no-cache --virtual .build-deps \
58
60
gcc \
59
61
libc-dev \
@@ -67,10 +69,19 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
67
69
libxslt-dev \
68
70
gd-dev \
69
71
geoip-dev \
72
+ && apk add --no-cache --virtual .brotli-build-deps \
73
+ autoconf \
74
+ libtool \
75
+ automake \
70
76
git \
77
+ g++ \
78
+ cmake \
79
+ && mkdir -p /usr/src \
80
+ && cd /usr/src \
81
+ && echo "Downloading Nginx" \
71
82
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
72
83
&& 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
74
85
&& export GNUPGHOME="$(mktemp -d)" \
75
86
&& found='' ; \
76
87
for server in \
@@ -85,15 +96,14 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
85
96
test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \
86
97
gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
87
98
&& rm -rf "$GNUPGHOME" nginx.tar.gz.asc \
88
- && mkdir -p /usr/src \
89
99
&& tar -zxC /usr/src -f nginx.tar.gz \
90
- && tar -zxC /usr/src -f openssl-1.1.1b.tar.gz \
91
100
&& rm -f nginx.tar.gz \
92
- && rm -f openssl-1.1.1b.tar.gz \
101
+ # Downloading Brotli
102
+ && echo "Downloading Brotli" \
93
103
&& 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" \
97
107
&& cd /usr/src/nginx-$NGINX_VERSION \
98
108
&& ./configure $CONFIG --with-debug \
99
109
&& make -j$(getconf _NPROCESSORS_ONLN) \
@@ -119,7 +129,6 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
119
129
&& strip /usr/sbin/nginx* \
120
130
&& strip /usr/lib/nginx/modules/*.so \
121
131
&& rm -rf /usr/src/nginx-$NGINX_VERSION \
122
- && rm -rf /usr/src/openssl-1.1.1b \
123
132
&& rm -rf /usr/src/ngx_brotli \
124
133
\
125
134
# Bring in gettext so we can get `envsubst`, then throw
@@ -129,14 +138,16 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
129
138
&& apk add --no-cache --virtual .gettext gettext \
130
139
&& mv /usr/bin/envsubst /tmp/ \
131
140
\
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(/,/, " \n so:", $2); print " so:" $2 }' \
144
+ | sort -u \
145
+ | xargs -r apk info --installed \
135
146
| sort -u \
136
- | awk 'system(" [ -e /usr/local/lib/" $1 " ]") == 0 { next } { print " so:" $1 }' \
137
147
)" \
138
148
&& apk add --no-cache --virtual .nginx-rundeps $runDeps \
139
149
&& apk del .build-deps \
150
+ && apk del .brotli-build-deps \
140
151
&& apk del .gettext \
141
152
&& mv /tmp/envsubst /usr/local/bin/ \
142
153
\
@@ -151,8 +162,8 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
151
162
COPY nginx.conf /etc/nginx/nginx.conf
152
163
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
153
164
154
- EXPOSE 80
165
+ EXPOSE 80 443
155
166
156
167
STOPSIGNAL SIGTERM
157
168
158
- CMD ["nginx" , "-g" , "daemon off;" ]
169
+ CMD ["nginx" , "-g" , "daemon off;" ]
0 commit comments