-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
86 lines (78 loc) · 2.42 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
FROM alpine:3.10
ENV NGINX_VERSION=1.18.0
WORKDIR /usr/local
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk update \
&& apk add --no-cache --virtual .build-deps \
gcc \
autoconf \
git \
make \
pcre-dev \
zlib-dev \
gd-dev \
geoip-dev \
linux-headers \
libc-dev \
libedit-dev \
libxml2-dev \
libxslt-dev \
libressl-dev \
&& wget -c "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" \
&& git clone --depth 1 https://github.com/aperezdc/ngx-fancyindex.git \
&& tar -zxf nginx-${NGINX_VERSION}.tar.gz \
&& cd nginx-${NGINX_VERSION} \
&& sed -i 's/\.openssl\///g' auto/lib/openssl/conf \
&& ./configure --prefix=/usr/share/nginx \
--conf-path=/etc/nginx/nginx.conf \
--sbin-path=/usr/sbin/nginx \
--modules-path=/usr/lib/nginx/modules \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--user=nginx \
--group=nginx \
--with-compat \
--with-pcre \
--with-threads \
--with-file-aio \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-stream_geoip_module=dynamic \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_v2_module \
--with-http_slice_module \
--with-http_realip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_mp4_module \
--with-http_image_filter_module \
--with-http_addition_module \
--with-http_random_index_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_auth_request_module \
--with-http_gunzip_module \
--with-http_xslt_module=dynamic \
--with-http_image_filter_module=dynamic \
--with-http_geoip_module=dynamic \
--with-openssl=/usr \
--add-dynamic-module=../ngx-fancyindex \
&& make -j$(nproc) \
&& make install \
&& make clean \
&& mkdir /etc/nginx/conf.d \
&& apk del gcc \
&& rm -rf /etc/nginx/*.default \
/usr/local/ngx-fancyindex \
/var/cache/apk/*
COPY nginx.conf /etc/nginx/
COPY default.conf /etc/nginx/conf.d/
RUN addgroup -g 10180 -S nginx \
&& adduser -S -D -H -u 10180 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \
&& chown -R nginx:nginx /var/log/nginx /usr/share/nginx/html \
&& nginx -t
EXPOSE 80 443
STOPSIGNAL SIGTERM
CMD nginx -g "daemon off;"