@@ -2,6 +2,14 @@ ARG NGINX_VERSION=1.19.2
2
2
3
3
# https://github.com/google/ngx_brotli
4
4
ARG NGX_BROTLI_COMMIT=25f86f0bac1101b6512135eac5f93c49c63609e3
5
+
6
+ # https://github.com/vision5/ngx_devel_kit/releases
7
+ # https://hub.docker.com/r/firesh/nginx-lua/dockerfile
8
+ ARG NGX_DEVEL_KIT_VERSION=0.3.1
9
+
10
+ # https://github.com/openresty/luajit2/releases
11
+ ARG LUA_NGINX_MODULE_VERSION=0.10.17
12
+
5
13
ARG CONFIG="\
6
14
--prefix=/etc/nginx \
7
15
--sbin-path=/usr/sbin/nginx \
@@ -47,6 +55,9 @@ ARG CONFIG="\
47
55
--with-file-aio \
48
56
--with-http_v2_module \
49
57
--add-module=/usr/src/ngx_brotli \
58
+ --with-ld-opt=" -Wl,-rpath,/usr/lib" \
59
+ --add-module=/tmp/ngx_devel_kit-${NGX_DEVEL_KIT_VERSION} \
60
+ --add-module=/tmp/lua-nginx-module-${LUA_NGINX_MODULE_VERSION} \
50
61
"
51
62
52
63
FROM alpine:3.12
55
66
ARG NGINX_VERSION
56
67
ARG NGX_BROTLI_COMMIT
57
68
ARG CONFIG
69
+ ARG NGX_DEVEL_KIT_VERSION
70
+ ARG LUA_NGINX_MODULE_VERSION
58
71
59
72
RUN \
60
73
apk add --no-cache --virtual .build-deps \
70
83
libxslt-dev \
71
84
gd-dev \
72
85
geoip-dev \
86
+ luajit \
87
+ luajit-dev \
73
88
&& apk add --no-cache --virtual .brotli-build-deps \
74
89
autoconf \
75
90
libtool \
81
96
COPY nginx.pub /tmp/nginx.pub
82
97
83
98
RUN \
84
- echo "Compiling nginx $NGINX_VERSION with brotli $NGX_BROTLI_COMMIT" \
85
- && mkdir -p /usr/src/ngx_brotli \
99
+ echo "Fetcing lua-nginx-module $LUA_NGINX_MODULE_VERSION and nginx devel kit $NGX_DEVEL_KIT_VERSION ..." \
100
+ && curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${NGX_DEVEL_KIT_VERSION}.tar.gz -o /tmp/ndk.tar.gz \
101
+ && tar -xvf /tmp/ndk.tar.gz -C /tmp \
102
+ && curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${LUA_NGINX_MODULE_VERSION}.tar.gz -o /tmp/lua-nginx.tar.gz \
103
+ && tar -xvf /tmp/lua-nginx.tar.gz -C /tmp
104
+
105
+ RUN \
106
+ mkdir -p /usr/src/ngx_brotli \
86
107
&& cd /usr/src/ngx_brotli \
87
108
&& git init \
88
109
&& git remote add origin https://github.com/google/ngx_brotli.git \
@@ -100,7 +121,10 @@ RUN \
100
121
&& tar -zxC /usr/src -f nginx.tar.gz
101
122
102
123
RUN \
103
- cd /usr/src/nginx-$NGINX_VERSION \
124
+ export LUAJIT_LIB=/usr/lib \
125
+ && export LUAJIT_INC=/usr/include/luajit-2.1 \
126
+ && echo "Compiling nginx $NGINX_VERSION with brotli $NGX_BROTLI_COMMIT and lua nginx module v$LUA_NGINX_MODULE_VERSION ..." \
127
+ && cd /usr/src/nginx-$NGINX_VERSION \
104
128
&& ./configure $CONFIG --with-debug \
105
129
&& make -j$(getconf _NPROCESSORS_ONLN) \
106
130
&& mv objs/nginx objs/nginx-debug \
@@ -145,6 +169,8 @@ RUN \
145
169
146
170
FROM alpine:3.12
147
171
ARG NGINX_VERSION
172
+ ARG NGX_BROTLI_COMMIT
173
+ ARG LUA_NGINX_MODULE_VERSION
148
174
149
175
COPY --from=0 /tmp/runDeps.txt /tmp/runDeps.txt
150
176
COPY --from=0 /etc/nginx /etc/nginx
@@ -168,6 +194,10 @@ RUN \
168
194
COPY nginx.conf /etc/nginx/nginx.conf
169
195
COPY ssl_common.conf /etc/nginx/conf.d/ssl_common.conf
170
196
197
+ ENV NGINX_VERSION $NGINX_VERSION
198
+ ENV NGX_BROTLI_COMMIT $NGX_BROTLI_COMMIT
199
+ ENV LUA_NGINX_MODULE_VERSION $LUA_NGINX_MODULE_VERSION
200
+
171
201
EXPOSE 80 443
172
202
173
203
STOPSIGNAL SIGTERM
0 commit comments