forked from by-sabbir/geoip2-nginx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (24 loc) · 1011 Bytes
/
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
ARG NGINX_TAG=alpine
FROM nginx:$NGINX_TAG
RUN apk add libmaxminddb libmaxminddb-dev --repository=https://pkgs.alpinelinux.org/package/edge/main/x86/libmaxmindd \
&& apk add \
alpine-sdk \
wget \
pcre-dev \
zlib-dev \
git
RUN echo "export NGINX_VER=`/usr/sbin/nginx -v 2>&1 | /usr/bin/cut -d / -f2`" >> /envfile
RUN . /envfile; echo $NGINX_VER
RUN cat /envfile
RUN cd /opt \
&& . /envfile \
&& git clone https://github.com/leev/ngx_http_geoip2_module.git \
&& wget -O - http://nginx.org/download/nginx-$NGINX_VER.tar.gz | tar zxfv - \
&& mv /opt/nginx-$NGINX_VER /opt/nginx \
&& cd /opt/nginx \
&& ./configure --with-compat --add-dynamic-module=/opt/ngx_http_geoip2_module \
&& make modules
FROM nginx:$NGINX_TAG
COPY --from=0 /opt/nginx/objs/ngx_http_geoip2_module.so /etc/nginx/modules
RUN apk add certbot certbot-nginx \
&& apk add libmaxminddb --repository=https://pkgs.alpinelinux.org/package/edge/main/x86/libmaxmindd