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