|
| 1 | +FROM alpine:latest |
| 2 | + |
| 3 | +MAINTAINER NGINX Docker Maintainers "docker-maint@nginx.com" |
| 4 | + |
| 5 | +ENV NGINX_VERSION 1.9.11 |
| 6 | + |
| 7 | +ENV GPG_KEYS B0F4253373F8F6F510D42178520A9993A1C052F8 |
| 8 | +ENV CONFIG "\ |
| 9 | + --prefix=/etc/nginx \ |
| 10 | + --sbin-path=/usr/sbin/nginx \ |
| 11 | + --conf-path=/etc/nginx/nginx.conf \ |
| 12 | + --error-log-path=/var/log/nginx/error.log \ |
| 13 | + --http-log-path=/var/log/nginx/access.log \ |
| 14 | + --pid-path=/var/run/nginx.pid \ |
| 15 | + --lock-path=/var/run/nginx.lock \ |
| 16 | + --http-client-body-temp-path=/var/cache/nginx/client_temp \ |
| 17 | + --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ |
| 18 | + --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ |
| 19 | + --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ |
| 20 | + --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ |
| 21 | + --user=nginx \ |
| 22 | + --group=nginx \ |
| 23 | + --with-http_ssl_module \ |
| 24 | + --with-http_realip_module \ |
| 25 | + --with-http_addition_module \ |
| 26 | + --with-http_sub_module \ |
| 27 | + --with-http_dav_module \ |
| 28 | + --with-http_flv_module \ |
| 29 | + --with-http_mp4_module \ |
| 30 | + --with-http_gunzip_module \ |
| 31 | + --with-http_gzip_static_module \ |
| 32 | + --with-http_random_index_module \ |
| 33 | + --with-http_secure_link_module \ |
| 34 | + --with-http_stub_status_module \ |
| 35 | + --with-http_auth_request_module \ |
| 36 | + --with-threads \ |
| 37 | + --with-stream \ |
| 38 | + --with-stream_ssl_module \ |
| 39 | + --with-http_slice_module \ |
| 40 | + --with-mail \ |
| 41 | + --with-mail_ssl_module \ |
| 42 | + --with-file-aio \ |
| 43 | + --with-http_v2_module \ |
| 44 | + --with-ipv6 \ |
| 45 | + " |
| 46 | + |
| 47 | +RUN \ |
| 48 | + addgroup -S nginx \ |
| 49 | + && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \ |
| 50 | + && apk add --no-cache --virtual .build-deps \ |
| 51 | + gcc \ |
| 52 | + libc-dev \ |
| 53 | + make \ |
| 54 | + openssl-dev \ |
| 55 | + pcre-dev \ |
| 56 | + zlib-dev \ |
| 57 | + linux-headers \ |
| 58 | + curl \ |
| 59 | + gnupg \ |
| 60 | + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEYS" \ |
| 61 | + && curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \ |
| 62 | + && curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \ |
| 63 | + && gpg --verify nginx.tar.gz.asc \ |
| 64 | + && mkdir -p /usr/src \ |
| 65 | + && tar -zxC /usr/src -f nginx.tar.gz \ |
| 66 | + && rm nginx.tar.gz* \ |
| 67 | + && rm -r /root/.gnupg \ |
| 68 | + && cd /usr/src/nginx-$NGINX_VERSION \ |
| 69 | + && ./configure $CONFIG --with-debug \ |
| 70 | + && make \ |
| 71 | + && mv objs/nginx objs/nginx-debug \ |
| 72 | + && ./configure $CONFIG \ |
| 73 | + && make \ |
| 74 | + && make install \ |
| 75 | + && install -m755 objs/nginx-debug /usr/sbin/nginx-debug \ |
| 76 | + && strip /usr/sbin/nginx* \ |
| 77 | + && runDeps="$( \ |
| 78 | + scanelf --needed --nobanner /usr/sbin/nginx \ |
| 79 | + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ |
| 80 | + | sort -u \ |
| 81 | + | xargs -r apk info --installed \ |
| 82 | + | sort -u \ |
| 83 | + )" \ |
| 84 | + && apk add --virtual .nginx-rundeps $runDeps \ |
| 85 | + && apk del .build-deps \ |
| 86 | + && rm -rf /usr/src/nginx-* \ |
| 87 | + \ |
| 88 | + # forward request and error logs to docker log collector |
| 89 | + && ln -sf /dev/stdout /var/log/nginx/access.log \ |
| 90 | + && ln -sf /dev/stderr /var/log/nginx/error.log |
| 91 | + |
| 92 | +EXPOSE 80 443 |
| 93 | + |
| 94 | +CMD ["nginx", "-g", "daemon off;"] |
0 commit comments