Skip to content

Commit 29a0466

Browse files
committed
Bumped to nginx 1.15.3 and alpine 3.8
1 parent 7205dfd commit 29a0466

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

Dockerfile

+25-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM alpine:3.4
1+
FROM alpine:3.8
22

3-
MAINTAINER Elisiano Petrini "[email protected]"
3+
LABEL maintainer="Elisiano Petrini <[email protected]>"
44

5-
ENV NGINX_VERSION 1.11.8
5+
ENV NGINX_VERSION 1.15.3
66

77
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
88
&& CONFIG="\
@@ -83,12 +83,22 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
8383
&& apk add --no-cache \
8484
yajl \
8585
libstdc++ \
86-
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
87-
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
86+
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
87+
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
8888
&& export GNUPGHOME="$(mktemp -d)" \
89-
&& gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys "$GPG_KEYS" \
90-
&& gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
91-
&& rm -r "$GNUPGHOME" nginx.tar.gz.asc \
89+
&& found=''; \
90+
for server in \
91+
ha.pool.sks-keyservers.net \
92+
hkp://keyserver.ubuntu.com:80 \
93+
hkp://p80.pool.sks-keyservers.net:80 \
94+
pgp.mit.edu \
95+
; do \
96+
echo "Fetching GPG key $GPG_KEYS from $server"; \
97+
gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" && found=yes && break; \
98+
done; \
99+
test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \
100+
gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
101+
&& rm -rf "$GNUPGHOME" nginx.tar.gz.asc \
92102
&& mkdir -p /usr/src \
93103
&& tar -zxC /usr/src -f nginx.tar.gz \
94104
&& rm nginx.tar.gz \
@@ -167,13 +177,19 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
167177
&& mv /tmp/envsubst /usr/local/bin/ \
168178
&& rm -rf /usr/src/ModSecurity /usr/src/ModSecurity-nginx \
169179
\
180+
# Bring in tzdata so users could set the timezones through the environment
181+
# variables
182+
&& apk add --no-cache tzdata \
183+
\
170184
# forward request and error logs to docker log collector
171185
&& ln -sf /dev/stdout /var/log/nginx/access.log \
172186
&& ln -sf /dev/stderr /var/log/nginx/error.log
173187

174188
COPY nginx.conf /etc/nginx/nginx.conf
175189
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
176190

177-
EXPOSE 80 443
191+
EXPOSE 80
192+
193+
STOPSIGNAL SIGTERM
178194

179195
CMD ["nginx", "-g", "daemon off;"]

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
# NGINX with libModSecurity + ModSecurity-nginx connector
2-
The dockerfile of this container has been copied from the [official nginx repo (alpine variant)](https://raw.githubusercontent.com/nginxinc/docker-nginx/3e8a6ee0603bf6c9cd8846c5fa43e96b13b0f44b/mainline/alpine/Dockerfile) and has been modified to add [ModSecurity library (v3)](https://github.com/SpiderLabs/ModSecurity/tree/v3/master) + [ModSecurity nginx connector](https://github.com/SpiderLabs/ModSecurity-nginx).
2+
3+
The dockerfile of this container has been copied from the [official nginx repo (alpine-perl variant)](https://github.com/nginxinc/docker-nginx/blob/1.15.3/mainline/alpine-perl/Dockerfile) and has been modified to add [ModSecurity library (v3)](https://github.com/SpiderLabs/ModSecurity/tree/v3/master) + [ModSecurity nginx connector](https://github.com/SpiderLabs/ModSecurity-nginx).
34

45
You can refer to the [official nginx image documentation](https://hub.docker.com/_/nginx/) for instructions on how to use this image.
56

67
When you provide your configuration you can enable modsecurity. Please refer to [their wiki](https://github.com/SpiderLabs/ModSecurity/wiki) for documentation.
78

89
NOTE: no rules are shipped with this container, if you enable modsecurity you need to provide your own
10+
11+
12+
## Extras
13+
14+
If you're curious to know the difference from this dockerfile and the upstream one:
15+
16+
```bash
17+
diff <(curl -fsL https://github.com/nginxinc/docker-nginx/raw/1.15.3/mainline/alpine-perl/Dockerfile) <(curl -fsL http://github.com/elisiano/docker-nginx-modsecurity/raw/master/Dockerfile)
18+
```

nginx.vh.default.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ server {
33
server_name localhost;
44

55
#charset koi8-r;
6-
#access_log /var/log/nginx/log/host.access.log main;
6+
#access_log /var/log/nginx/host.access.log main;
77

88
modsecurity on;
99
location / {

0 commit comments

Comments
 (0)