|
1 | | -FROM alpine:3.4 |
| 1 | +FROM alpine:3.9 |
2 | 2 |
|
3 | | -MAINTAINER Johannes Boesl "[email protected]" |
| 3 | +LABEL maintainer="NGINX Docker Maintainers <[email protected]>" |
4 | 4 |
|
5 | | -ENV NGINX_VERSION 1.11.4 |
| 5 | +ENV NGINX_VERSION 1.15.8 |
6 | 6 |
|
7 | | -ENV HEADERS_MORE=0.31 |
| 7 | +ENV HEADERS_MORE=0.33 |
8 | 8 | ENV SOURCE_DIR=/tmp/src |
9 | 9 |
|
10 | 10 | RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \ |
11 | | - && CONFIG="\ |
12 | | - --prefix=/etc/nginx \ |
13 | | - --sbin-path=/usr/sbin/nginx \ |
14 | | - --modules-path=/usr/lib/nginx/modules \ |
15 | | - --conf-path=/etc/nginx/nginx.conf \ |
16 | | - --error-log-path=/var/log/nginx/error.log \ |
17 | | - --http-log-path=/var/log/nginx/access.log \ |
18 | | - --pid-path=/var/run/nginx.pid \ |
19 | | - --lock-path=/var/run/nginx.lock \ |
20 | | - --http-client-body-temp-path=/var/cache/nginx/client_temp \ |
21 | | - --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ |
22 | | - --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ |
23 | | - --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ |
24 | | - --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ |
25 | | - --user=nginx \ |
26 | | - --group=nginx \ |
27 | | - --with-http_ssl_module \ |
28 | | - --with-http_realip_module \ |
29 | | - --with-http_addition_module \ |
30 | | - --with-http_sub_module \ |
31 | | - --with-http_dav_module \ |
32 | | - --with-http_flv_module \ |
33 | | - --with-http_mp4_module \ |
34 | | - --with-http_gunzip_module \ |
35 | | - --with-http_gzip_static_module \ |
36 | | - --with-http_random_index_module \ |
37 | | - --with-http_secure_link_module \ |
38 | | - --with-http_stub_status_module \ |
39 | | - --with-http_auth_request_module \ |
40 | | - --with-http_xslt_module=dynamic \ |
41 | | - --with-http_image_filter_module=dynamic \ |
42 | | - --with-http_geoip_module=dynamic \ |
43 | | - --with-http_perl_module=dynamic \ |
44 | | - --with-threads \ |
45 | | - --with-stream \ |
46 | | - --with-stream_ssl_module \ |
47 | | - --with-stream_realip_module \ |
48 | | - --with-stream_geoip_module=dynamic \ |
49 | | - --with-http_slice_module \ |
50 | | - --with-mail \ |
51 | | - --with-mail_ssl_module \ |
52 | | - --with-file-aio \ |
53 | | - --with-http_v2_module \ |
54 | | - --with-ipv6 \ |
55 | | - --add-module=${SOURCE_DIR}/headers-more-nginx-module-"$HEADERS_MORE" \ |
56 | | - " \ |
57 | | - && addgroup -S nginx \ |
58 | | - && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \ |
59 | | - && apk add --no-cache --virtual .build-deps \ |
60 | | - gcc \ |
61 | | - libc-dev \ |
62 | | - make \ |
63 | | - openssl-dev \ |
64 | | - pcre-dev \ |
65 | | - zlib-dev \ |
66 | | - linux-headers \ |
67 | | - curl \ |
68 | | - gnupg \ |
69 | | - libxslt-dev \ |
70 | | - gd-dev \ |
71 | | - geoip-dev \ |
72 | | - perl-dev \ |
73 | | - && mkdir -p "$SOURCE_DIR" \ |
74 | | - && cd "$SOURCE_DIR" \ |
75 | | - && curl -L https://github.com/openresty/headers-more-nginx-module/archive/v"$HEADERS_MORE".tar.gz | tar -xz \ |
76 | | - && curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \ |
77 | | - && curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \ |
78 | | - && export GNUPGHOME="$(mktemp -d)" \ |
79 | | - && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEYS" \ |
80 | | - && gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \ |
81 | | - && rm -r "$GNUPGHOME" nginx.tar.gz.asc \ |
82 | | - && mkdir -p /usr/src \ |
83 | | - && tar -zxC /usr/src -f nginx.tar.gz \ |
84 | | - && rm nginx.tar.gz \ |
85 | | - && cd /usr/src/nginx-$NGINX_VERSION \ |
86 | | - && ./configure $CONFIG --with-debug \ |
87 | | - && make -j$(getconf _NPROCESSORS_ONLN) \ |
88 | | - && mv objs/nginx objs/nginx-debug \ |
89 | | - && mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \ |
90 | | - && mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \ |
91 | | - && mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \ |
92 | | - && mv objs/ngx_http_perl_module.so objs/ngx_http_perl_module-debug.so \ |
93 | | - && mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \ |
94 | | - && ./configure $CONFIG \ |
95 | | - && make -j$(getconf _NPROCESSORS_ONLN) \ |
96 | | - && make install \ |
97 | | - && rm -rf /etc/nginx/html/ \ |
98 | | - && mkdir /etc/nginx/conf.d/ \ |
99 | | - && mkdir -p /usr/share/nginx/html/ \ |
100 | | - && install -m644 html/index.html /usr/share/nginx/html/ \ |
101 | | - && install -m644 html/50x.html /usr/share/nginx/html/ \ |
102 | | - && install -m755 objs/nginx-debug /usr/sbin/nginx-debug \ |
103 | | - && install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \ |
104 | | - && install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \ |
105 | | - && install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \ |
106 | | - && install -m755 objs/ngx_http_perl_module-debug.so /usr/lib/nginx/modules/ngx_http_perl_module-debug.so \ |
107 | | - && install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \ |
108 | | - && ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \ |
109 | | - && strip /usr/sbin/nginx* \ |
110 | | - && strip /usr/lib/nginx/modules/*.so \ |
111 | | - && rm -rf /usr/src/nginx-$NGINX_VERSION \ |
112 | | - \ |
113 | | - # Bring in gettext so we can get `envsubst`, then throw |
114 | | - # the rest away. To do this, we need to install `gettext` |
115 | | - # then move `envsubst` out of the way so `gettext` can |
116 | | - # be deleted completely, then move `envsubst` back. |
117 | | - && apk add --no-cache --virtual .gettext gettext \ |
118 | | - && mv /usr/bin/envsubst /tmp/ \ |
119 | | - \ |
120 | | - && runDeps="$( \ |
121 | | - scanelf --needed --nobanner /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \ |
122 | | - | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ |
123 | | - | sort -u \ |
124 | | - | xargs -r apk info --installed \ |
125 | | - | sort -u \ |
126 | | - )" \ |
127 | | - && apk add --no-cache --virtual .nginx-rundeps $runDeps \ |
128 | | - && apk del .build-deps \ |
129 | | - && apk del .gettext \ |
130 | | - && mv /tmp/envsubst /usr/local/bin/ \ |
131 | | - \ |
132 | | - # forward request and error logs to docker log collector |
133 | | - && ln -sf /dev/stdout /var/log/nginx/access.log \ |
134 | | - && ln -sf /dev/stderr /var/log/nginx/error.log \ |
135 | | - && rm -rf "$SOURCE_DIR" |
| 11 | +&& CONFIG="\ |
| 12 | +--prefix=/etc/nginx \ |
| 13 | +--sbin-path=/usr/sbin/nginx \ |
| 14 | +--modules-path=/usr/lib/nginx/modules \ |
| 15 | +--conf-path=/etc/nginx/nginx.conf \ |
| 16 | +--error-log-path=/var/log/nginx/error.log \ |
| 17 | +--http-log-path=/var/log/nginx/access.log \ |
| 18 | +--pid-path=/var/run/nginx.pid \ |
| 19 | +--lock-path=/var/run/nginx.lock \ |
| 20 | +--http-client-body-temp-path=/var/cache/nginx/client_temp \ |
| 21 | +--http-proxy-temp-path=/var/cache/nginx/proxy_temp \ |
| 22 | +--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ |
| 23 | +--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ |
| 24 | +--http-scgi-temp-path=/var/cache/nginx/scgi_temp \ |
| 25 | +--user=nginx \ |
| 26 | +--group=nginx \ |
| 27 | +--with-http_ssl_module \ |
| 28 | +--with-http_realip_module \ |
| 29 | +--with-http_addition_module \ |
| 30 | +--with-http_sub_module \ |
| 31 | +--with-http_dav_module \ |
| 32 | +--with-http_flv_module \ |
| 33 | +--with-http_mp4_module \ |
| 34 | +--with-http_gunzip_module \ |
| 35 | +--with-http_gzip_static_module \ |
| 36 | +--with-http_random_index_module \ |
| 37 | +--with-http_secure_link_module \ |
| 38 | +--with-http_stub_status_module \ |
| 39 | +--with-http_auth_request_module \ |
| 40 | +--with-http_xslt_module=dynamic \ |
| 41 | +--with-http_image_filter_module=dynamic \ |
| 42 | +--with-http_geoip_module=dynamic \ |
| 43 | +--with-threads \ |
| 44 | +--with-stream \ |
| 45 | +--with-stream_ssl_module \ |
| 46 | +--with-stream_ssl_preread_module \ |
| 47 | +--with-stream_realip_module \ |
| 48 | +--with-stream_geoip_module=dynamic \ |
| 49 | +--with-http_slice_module \ |
| 50 | +--with-mail \ |
| 51 | +--with-mail_ssl_module \ |
| 52 | +--with-compat \ |
| 53 | +--with-file-aio \ |
| 54 | +--with-http_v2_module \ |
| 55 | +--add-module=${SOURCE_DIR}/headers-more-nginx-module-"$HEADERS_MORE" \ |
| 56 | +" \ |
| 57 | +&& addgroup -S nginx \ |
| 58 | +&& adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \ |
| 59 | +&& apk add --no-cache --virtual .build-deps \ |
| 60 | +gcc \ |
| 61 | +libc-dev \ |
| 62 | +make \ |
| 63 | +openssl-dev \ |
| 64 | +pcre-dev \ |
| 65 | +zlib-dev \ |
| 66 | +linux-headers \ |
| 67 | +curl \ |
| 68 | +gnupg1 \ |
| 69 | +libxslt-dev \ |
| 70 | +gd-dev \ |
| 71 | +geoip-dev \ |
| 72 | +perl-dev \ |
| 73 | + |
| 74 | +&& mkdir -p "$SOURCE_DIR" \ |
| 75 | +&& cd "$SOURCE_DIR" \ |
| 76 | +&& curl -L https://github.com/openresty/headers-more-nginx-module/archive/v"$HEADERS_MORE".tar.gz | tar -xz \ |
| 77 | +&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \ |
| 78 | +&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \ |
| 79 | +&& export GNUPGHOME="$(mktemp -d)" \ |
| 80 | +&& found=''; \ |
| 81 | +for server in \ |
| 82 | +ha.pool.sks-keyservers.net \ |
| 83 | +hkp://keyserver.ubuntu.com:80 \ |
| 84 | +hkp://p80.pool.sks-keyservers.net:80 \ |
| 85 | +pgp.mit.edu \ |
| 86 | +; do \ |
| 87 | +echo "Fetching GPG key $GPG_KEYS from $server"; \ |
| 88 | +gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" && found=yes && break; \ |
| 89 | +done; \ |
| 90 | +test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \ |
| 91 | +gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \ |
| 92 | +&& rm -rf "$GNUPGHOME" nginx.tar.gz.asc \ |
| 93 | +&& mkdir -p /usr/src \ |
| 94 | +&& tar -zxC /usr/src -f nginx.tar.gz \ |
| 95 | +&& rm nginx.tar.gz \ |
| 96 | +&& cd /usr/src/nginx-$NGINX_VERSION \ |
| 97 | +&& ./configure $CONFIG --with-debug \ |
| 98 | +&& make -j$(getconf _NPROCESSORS_ONLN) \ |
| 99 | +&& mv objs/nginx objs/nginx-debug \ |
| 100 | +&& mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \ |
| 101 | +&& mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \ |
| 102 | +&& mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \ |
| 103 | +&& mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \ |
| 104 | +&& ./configure $CONFIG \ |
| 105 | +&& make -j$(getconf _NPROCESSORS_ONLN) \ |
| 106 | +&& make install \ |
| 107 | +&& rm -rf /etc/nginx/html/ \ |
| 108 | +&& mkdir /etc/nginx/conf.d/ \ |
| 109 | +&& mkdir -p /usr/share/nginx/html/ \ |
| 110 | +&& install -m644 html/index.html /usr/share/nginx/html/ \ |
| 111 | +&& install -m644 html/50x.html /usr/share/nginx/html/ \ |
| 112 | +&& install -m755 objs/nginx-debug /usr/sbin/nginx-debug \ |
| 113 | +&& install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \ |
| 114 | +&& install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \ |
| 115 | +&& install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \ |
| 116 | +&& install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \ |
| 117 | +&& ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \ |
| 118 | +&& strip /usr/sbin/nginx* \ |
| 119 | +&& strip /usr/lib/nginx/modules/*.so \ |
| 120 | +&& rm -rf /usr/src/nginx-$NGINX_VERSION \ |
| 121 | +\ |
| 122 | +# Bring in gettext so we can get `envsubst`, then throw |
| 123 | +# the rest away. To do this, we need to install `gettext` |
| 124 | +# then move `envsubst` out of the way so `gettext` can |
| 125 | +# be deleted completely, then move `envsubst` back. |
| 126 | +&& apk add --no-cache --virtual .gettext gettext \ |
| 127 | +&& mv /usr/bin/envsubst /tmp/ \ |
| 128 | +\ |
| 129 | +&& runDeps="$( \ |
| 130 | +scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \ |
| 131 | +| tr ',' '\n' \ |
| 132 | +| sort -u \ |
| 133 | +| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ |
| 134 | +)" \ |
| 135 | +&& apk add --no-cache --virtual .nginx-rundeps $runDeps \ |
| 136 | +&& apk del .build-deps \ |
| 137 | +&& apk del .gettext \ |
| 138 | +&& mv /tmp/envsubst /usr/local/bin/ \ |
| 139 | +\ |
| 140 | +# Bring in tzdata so users could set the timezones through the environment |
| 141 | +# variables |
| 142 | +&& apk add --no-cache tzdata \ |
| 143 | +\ |
| 144 | +# forward request and error logs to docker log collector |
| 145 | +&& ln -sf /dev/stdout /var/log/nginx/access.log \ |
| 146 | +&& ln -sf /dev/stderr /var/log/nginx/error.log \ |
| 147 | +&& rm -rf "$SOURCE_DIR" |
136 | 148 |
|
137 | 149 | COPY nginx.conf /etc/nginx/nginx.conf |
138 | 150 | COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf |
139 | 151 |
|
140 | | -EXPOSE 80 443 |
| 152 | +EXPOSE 80 |
| 153 | + |
| 154 | +STOPSIGNAL SIGTERM |
141 | 155 |
|
142 | 156 | CMD ["nginx", "-g", "daemon off;"] |
0 commit comments