@@ -13,11 +13,15 @@ ARG DOCKER_IMAGE_VERSION=unknown
13
13
# Define software versions.
14
14
ARG OPENRESTY_VERSION=1.19.3.1
15
15
ARG NGINX_PROXY_MANAGER_VERSION=2.7.3
16
+ ARG NGINX_HTTP_GEOIP2_MODULE_VERSION=3.3
17
+ ARG LIBMAXMINDDB_VERSION=1.5.0
16
18
ARG WATCH_VERSION=0.3.1
17
19
18
20
# Define software download URLs.
19
21
ARG OPENRESTY_URL=https://openresty.org/download/openresty-${OPENRESTY_VERSION}.tar.gz
20
22
ARG NGINX_PROXY_MANAGER_URL=https://github.com/jc21/nginx-proxy-manager/archive/v${NGINX_PROXY_MANAGER_VERSION}.tar.gz
23
+ ARG NGINX_HTTP_GEOIP2_MODULE_URL=https://github.com/leev/ngx_http_geoip2_module/archive/${NGINX_HTTP_GEOIP2_MODULE_VERSION}.tar.gz
24
+ ARG LIBMAXMINDDB_URL=https://github.com/maxmind/libmaxminddb/releases/download/${LIBMAXMINDDB_VERSION}/libmaxminddb-${LIBMAXMINDDB_VERSION}.tar.gz
21
25
ARG WATCH_URL=https://github.com/tj/watch/archive/${WATCH_VERSION}.tar.gz
22
26
23
27
# Define working directory.
60
64
pcre-dev \
61
65
openssl-dev \
62
66
zlib-dev \
63
- geoip-dev \
64
67
&& \
65
68
# Set same default compilation flags as abuild.
66
69
export CFLAGS="-Os -fomit-frame-pointer" && \
71
74
echo "Downloading OpenResty..." && \
72
75
mkdir openresty && \
73
76
curl -# -L ${OPENRESTY_URL} | tar xz --strip 1 -C openresty && \
77
+ echo "Downloading GeoIP2 module..." && \
78
+ mkdir ngx_http_geoip2_module && \
79
+ curl -# -L ${NGINX_HTTP_GEOIP2_MODULE_URL} | tar xz --strip 1 -C ngx_http_geoip2_module && \
80
+ echo "Downloading libmaxminddb..." && \
81
+ mkdir libmaxminddb && \
82
+ curl -# -L ${LIBMAXMINDDB_URL} | tar xz --strip 1 -C libmaxminddb && \
74
83
# Compile.
84
+ echo "Compiling libmaxminddb..." && \
85
+ cd libmaxminddb && \
86
+ ./configure \
87
+ --prefix=/usr \
88
+ --mandir=/tmp/libmaxminddb-man \
89
+ --with-pic \
90
+ --enable-shared=no \
91
+ --enable-static=yes \
92
+ && \
93
+ make -j$(nproc) install && \
94
+ cd .. && \
75
95
echo "Compiling OpenResty..." && \
76
96
cd openresty && \
77
97
./configure -j$(nproc) \
@@ -112,13 +132,13 @@ RUN \
112
132
--with-http_degradation_module \
113
133
--with-http_slice_module \
114
134
--with-http_stub_status_module \
115
- --with-http_geoip_module \
116
135
--with-stream \
117
136
--with-stream_ssl_module \
118
137
--with-stream_realip_module \
119
138
--with-stream_ssl_preread_module \
120
- --with-stream_geoip_module \
121
139
--with-pcre-jit \
140
+ \
141
+ --add-module=/tmp/ngx_http_geoip2_module \
122
142
&& \
123
143
make -j$(nproc) && \
124
144
# Install.
@@ -144,6 +164,13 @@ RUN \
144
164
/var/lib/nginx/resty.index \
145
165
/var/lib/nginx/site \
146
166
&& \
167
+ rm \
168
+ /usr/include/maxminddb*.h \
169
+ /usr/lib/libmaxminddb* \
170
+ /usr/lib/pkgconfig/libmaxminddb.pc \
171
+ && \
172
+ [ -n "$(ls /usr/include)" ] || rm -r /usr/include && \
173
+ [ -n "$(ls /usr/lib/pkgconfig)" ] || rm -r /usr/lib/pkgconfig && \
147
174
rm -rf /tmp/* /tmp/.[!.]*
148
175
149
176
# Install dependencies.
@@ -160,7 +187,6 @@ RUN \
160
187
bash \
161
188
# For openresty
162
189
pcre \
163
- geoip \
164
190
&& \
165
191
# Adjust the logrotate config file.
166
192
sed-patch 's|^/var/log/messages|#/var/log/messages|' /etc/logrotate.conf
0 commit comments