Skip to content

Commit 6a5f430

Browse files
committed
Add geoip module
1 parent 0867663 commit 6a5f430

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

nginx/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ RUN adduser --system --disabled-password --home /var/cache/nginx --shell /sbin/n
2121
inotify-tools \
2222
curl \
2323
libyajl-dev \
24+
libgeoip1 \
2425
libgeoip-dev \
2526
dh-autoreconf \
2627
libcurl4-gnutls-dev \
@@ -38,6 +39,7 @@ RUN adduser --system --disabled-password --home /var/cache/nginx --shell /sbin/n
3839
&& cd /usr/src \
3940
# Create log and cache directories
4041
&& mkdir -p \
42+
/etc/nginx \
4143
/var/log/nginx \
4244
/var/cache/nginx \
4345
&& git clone https://github.com/SpiderLabs/ModSecurity.git --branch ${MODSECURITY_VERSION} --single-branch \
@@ -62,6 +64,11 @@ RUN adduser --system --disabled-password --home /var/cache/nginx --shell /sbin/n
6264
&& curl https://people.freebsd.org/~osa/ngx_http_redis-${NGX_HTTP_REDIS}.tar.gz | tar xz \
6365
&& git clone https://github.com/vozlt/nginx-module-vts.git --branch ${NGINX_MODULE_VTS_VERSION} --single-branch \
6466
&& curl -L https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar xz \
67+
# download GeoIP databases
68+
&& wget -O /etc/nginx/GeoIP.dat.gz https://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz \
69+
&& wget -O /etc/nginx/GeoLiteCity.dat.gz https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz \
70+
&& gunzip /etc/nginx/GeoIP.dat.gz \
71+
&& gunzip /etc/nginx/GeoLiteCity.dat.gz \
6572
### Disable Lua module until OpenSSL v1.1 compatible ###
6673
# && git clone https://github.com/simpl/ngx_devel_kit.git --branch ${NGX_DEVEL_KIT_VERSION} --single-branch \
6774
# && git clone https://github.com/openresty/lua-nginx-module.git --branch ${LUA_NGINX_MODULE_VERSION} --single-branch \
@@ -113,6 +120,7 @@ RUN adduser --system --disabled-password --home /var/cache/nginx --shell /sbin/n
113120
--with-http_auth_request_module \
114121
--with-http_dav_module \
115122
--with-http_flv_module \
123+
--with-http_geoip_module=dynamic \
116124
--with-http_gunzip_module \
117125
--with-http_gzip_static_module \
118126
--with-http_mp4_module \
@@ -146,6 +154,8 @@ RUN adduser --system --disabled-password --home /var/cache/nginx --shell /sbin/n
146154
wget \
147155
git \
148156
curl \
157+
libgeoip-dev \
158+
libpcre3-dev \
149159
&& apt-get clean \
150160
&& apt-get autoremove -y \
151161
&& rm -rf /var/lib/apt/lists/* \

0 commit comments

Comments
 (0)