1
1
FROM alpine:3.8
2
2
MAINTAINER JulianWang <
[email protected] >
3
3
4
- ENV NGINX_VERSION 1.15.3
4
+ ENV NGINX_VERSION 1.15.8
5
5
6
6
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
7
7
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
@@ -103,9 +103,8 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
103
103
&& tar -zxC /usr/src -f nginx.tar.gz \
104
104
&& rm nginx.tar.gz \
105
105
&& cd /usr/src \
106
- && git clone https://github.com/SpiderLabs/ModSecurity \
106
+ && git clone --depth 1 -b v3/master --single-branch https://github.com/SpiderLabs/ModSecurity \
107
107
&& cd ModSecurity \
108
- && git checkout v3/master \
109
108
&& git submodule init \
110
109
&& git submodule update \
111
110
&& sed -i -e 's/u_int64_t/uint64_t/g' \
@@ -126,8 +125,18 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
126
125
&& ./configure \
127
126
&& make \
128
127
&& make install \
128
+ && mkdir -p /etc/nginx/modsec.d \
129
+ && cp /usr/src/ModSecurity/modsecurity.conf-recommended /etc/nginx/modsec.d \
130
+ && mv /etc/nginx/modsec.d/modsecurity.conf-recommended /etc/nginx/modsec.d/modsecurity.conf \
131
+ && cp /usr/src/ModSecurity/unicode.mapping /etc/nginx/modsec.d \
132
+ && sed -i -e 's/SecRuleEngine DetectionOnly/SecRuleEngine On/g' /etc/nginx/modsec.d/modsecurity.conf \
133
+ && cd /etc/nginx/modsec.d \
134
+ && git clone --depth 1 https://github.com/SpiderLabs/owasp-modsecurity-crs \
135
+ && cd owasp-modsecurity-crs \
136
+ && mv crs-setup.conf.example crs-setup.conf \
137
+ && printf "include /etc/nginx/modsec.d/modsecurity.conf\n include /etc/nginx/modsec.d/owasp-modsecurity-crs/crs-setup.conf\n include /etc/nginx/modsec.d/owasp-modsecurity-crs/rules/*.conf\n " > /etc/nginx/modsec.d/main.conf \
129
138
&& cd /usr/src \
130
- && git clone https://github.com/SpiderLabs/ModSecurity-nginx \
139
+ && git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git \
131
140
&& cd /usr/src/nginx-$NGINX_VERSION \
132
141
&& ./configure $CONFIG --with-debug \
133
142
&& make -j$(getconf _NPROCESSORS_ONLN) \
0 commit comments