Skip to content

Commit dbec443

Browse files
committed
Added nginx_lua_module, nginx_devel_kit, luajit, luarocks and lua-cjson
lua rock
1 parent dc03485 commit dbec443

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# Image includes:
2+
# - nginx (with few common modules)
3+
# - nginx_upstream_module (for tarantool)
4+
# - nginx_lua_module (required by luajit)
5+
# - nginx_devel_kit (required by luajit)
6+
# - luajit
7+
# - luarocks
8+
# - lua rock "lua-cjson" (is necessary to work with tarantool response, can be extended with env variable)
9+
110
FROM alpine:3.4
211
MAINTAINER Konstantin Nazarov "mail@racktear.com"
312

@@ -11,6 +20,26 @@ ENV NGINX_VERSION=1.11.1 \
1120
NGINX_UPSTREAM_MODULE_COMMIT=8290d60 \
1221
NGINX_GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8
1322

23+
ENV NGINX_LUA_MODULE_URL=https://github.com/openresty/lua-nginx-module \
24+
NGINX_LUA_MODULE_PATH=/usr/src/lua-nginx-module
25+
26+
ENV NGINX_DEVEL_KIT_URL=https://github.com/simpl/ngx_devel_kit \
27+
NGINX_DEVEL_KIT_PATH=/usr/src/nginx-devel-kit
28+
29+
ENV LUAJIT_VERSION=2.0.5 \
30+
LUAJIT_URL=http://luajit.org/git/luajit-2.0.git \
31+
LUAJIT_PATH=/usr/src/luajit \
32+
LUAJIT_LIB=/usr/local/lib \
33+
LUAJIT_INC=/usr/local/include/luajit-2.0
34+
35+
ENV LUAROCKS_VERSION=2.4.2 \
36+
LUAROCKS_URL=https://github.com/luarocks/luarocks \
37+
LUAROCKS_PATH=/usr/src/luarocks
38+
39+
ENV LUAROCKS_ROCKS="\
40+
lua-cjson\
41+
"
42+
1443
RUN set -x \
1544
&& apk add --no-cache --virtual .build-deps \
1645
build-base \
@@ -27,16 +56,36 @@ RUN set -x \
2756
gnupg \
2857
curl \
2958
perl-dev \
59+
unzip \
3060
&& apk add --no-cache --virtual .run-deps \
3161
ca-certificates \
3262
openssl \
3363
pcre \
3464
zlib \
3565
libxslt \
66+
gcc \
3667
gd \
3768
geoip \
3869
perl \
3970
gettext \
71+
&& : "---------- download nginx-devel-kit ----------" \
72+
&& git clone "$NGINX_DEVEL_KIT_URL" $NGINX_DEVEL_KIT_PATH \
73+
&& : "---------- download nginx-lua-module ----------" \
74+
&& git clone "$NGINX_LUA_MODULE_URL" $NGINX_LUA_MODULE_PATH \
75+
&& : "---------- download luajit ----------" \
76+
&& git clone "$LUAJIT_URL" $LUAJIT_PATH \
77+
&& git -C $LUAJIT_PATH checkout tags/v$LUAJIT_VERSION \
78+
&& make -C $LUAJIT_PATH \
79+
&& make -C $LUAJIT_PATH install \
80+
&& : "---------- download and install luarocks (depends on luajit) ----------" \
81+
&& git clone $LUAROCKS_URL $LUAROCKS_PATH \
82+
&& git -C $LUAROCKS_PATH checkout tags/v$LUAROCKS_VERSION \
83+
&& ln -s /usr/local/bin/luajit-$LUAJIT_VERSION /usr/local/bin/lua \
84+
&& cd $LUAROCKS_PATH \
85+
&& ./configure --with-lua-bin=/usr/local/bin --with-lua-include=/usr/src/luajit/src/ \
86+
&& make build \
87+
&& make install \
88+
&& cd \
4089
&& : "---------- download nginx-upstream-module ----------" \
4190
&& git clone "$NGINX_UPSTREAM_MODULE_URL" /usr/src/nginx_upstream_module \
4291
&& git -C /usr/src/nginx_upstream_module checkout "${NGINX_UPSTREAM_MODULE_COMMIT}" \
@@ -101,6 +150,9 @@ RUN set -x \
101150
--with-file-aio \
102151
--with-http_v2_module \
103152
--with-ipv6 \
153+
--with-ld-opt="-Wl,-rpath,$LUAJIT_LIB" \
154+
--add-module=$NGINX_DEVEL_KIT_PATH \
155+
--add-module=$NGINX_LUA_MODULE_PATH \
104156
&& make \
105157
&& make install \
106158
&& rm -rf /etc/nginx/html/ \
@@ -117,6 +169,8 @@ RUN set -x \
117169
| sort -u \
118170
)" \
119171
&& apk add --virtual .run-deps $runDeps \
172+
&& : "---------- install lua rocks ----------" \
173+
&& for rock in $LUAROCKS_ROCKS; do luarocks install $rock; done \
120174
&& : "---------- remove build deps ----------" \
121175
&& rm -rf /usr/src/nginx \
122176
&& rm -rf /usr/src/nginx_upstream_module \

0 commit comments

Comments
 (0)