Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Image includes:
# - nginx (with few common modules)
# - nginx_upstream_module (for tarantool)
# - nginx_lua_module (required by luajit)
# - nginx_devel_kit (required by luajit)
# - luajit
# - luarocks
# - lua rock "lua-cjson" (is necessary to work with tarantool response, can be extended with env variable)

FROM alpine:3.4
MAINTAINER Konstantin Nazarov "mail@racktear.com"

Expand All @@ -11,6 +20,26 @@ ENV NGINX_VERSION=1.11.1 \
NGINX_UPSTREAM_MODULE_COMMIT=8290d60 \
NGINX_GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8

ENV NGINX_LUA_MODULE_URL=https://github.com/openresty/lua-nginx-module \
NGINX_LUA_MODULE_PATH=/usr/src/lua-nginx-module

ENV NGINX_DEVEL_KIT_URL=https://github.com/simpl/ngx_devel_kit \
NGINX_DEVEL_KIT_PATH=/usr/src/nginx-devel-kit

ENV LUAJIT_VERSION=2.0.5 \
LUAJIT_URL=http://luajit.org/git/luajit-2.0.git \
LUAJIT_PATH=/usr/src/luajit \
LUAJIT_LIB=/usr/local/lib \
LUAJIT_INC=/usr/local/include/luajit-2.0

ENV LUAROCKS_VERSION=2.4.2 \
LUAROCKS_URL=https://github.com/luarocks/luarocks \
LUAROCKS_PATH=/usr/src/luarocks

ENV LUAROCKS_ROCKS="\
lua-cjson\
"

RUN set -x \
&& apk add --no-cache --virtual .build-deps \
build-base \
Expand All @@ -27,16 +56,36 @@ RUN set -x \
gnupg \
curl \
perl-dev \
unzip \
&& apk add --no-cache --virtual .run-deps \
ca-certificates \
openssl \
pcre \
zlib \
libxslt \
gcc \
gd \
geoip \
perl \
gettext \
&& : "---------- download nginx-devel-kit ----------" \
&& git clone "$NGINX_DEVEL_KIT_URL" $NGINX_DEVEL_KIT_PATH \
&& : "---------- download nginx-lua-module ----------" \
&& git clone "$NGINX_LUA_MODULE_URL" $NGINX_LUA_MODULE_PATH \
&& : "---------- download luajit ----------" \
&& git clone "$LUAJIT_URL" $LUAJIT_PATH \
&& git -C $LUAJIT_PATH checkout tags/v$LUAJIT_VERSION \
&& make -C $LUAJIT_PATH \
&& make -C $LUAJIT_PATH install \
&& : "---------- download and install luarocks (depends on luajit) ----------" \
&& git clone $LUAROCKS_URL $LUAROCKS_PATH \
&& git -C $LUAROCKS_PATH checkout tags/v$LUAROCKS_VERSION \
&& ln -s /usr/local/bin/luajit-$LUAJIT_VERSION /usr/local/bin/lua \
&& cd $LUAROCKS_PATH \
&& ./configure --with-lua-bin=/usr/local/bin --with-lua-include=/usr/src/luajit/src/ \
&& make build \
&& make install \
&& cd \
&& : "---------- download nginx-upstream-module ----------" \
&& git clone "$NGINX_UPSTREAM_MODULE_URL" /usr/src/nginx_upstream_module \
&& git -C /usr/src/nginx_upstream_module checkout "${NGINX_UPSTREAM_MODULE_COMMIT}" \
Expand Down Expand Up @@ -101,6 +150,9 @@ RUN set -x \
--with-file-aio \
--with-http_v2_module \
--with-ipv6 \
--with-ld-opt="-Wl,-rpath,$LUAJIT_LIB" \
--add-module=$NGINX_DEVEL_KIT_PATH \
--add-module=$NGINX_LUA_MODULE_PATH \
&& make \
&& make install \
&& rm -rf /etc/nginx/html/ \
Expand All @@ -117,6 +169,8 @@ RUN set -x \
| sort -u \
)" \
&& apk add --virtual .run-deps $runDeps \
&& : "---------- install lua rocks ----------" \
&& for rock in $LUAROCKS_ROCKS; do luarocks install $rock; done \
&& : "---------- remove build deps ----------" \
&& rm -rf /usr/src/nginx \
&& rm -rf /usr/src/nginx_upstream_module \
Expand Down