-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
73 lines (68 loc) · 2.75 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM mutterio/mini-base
ENV OPENRESTY_VERSION 1.7.10.1
ENV OPENRESTY_PREFIX /opt/openresty
ENV NGINX_PREFIX /opt/openresty/nginx
ENV VAR_PREFIX /var/nginx
# NginX prefix is automatically set by OpenResty to $OPENRESTY_PREFIX/nginx
# look for $ngx_prefix in https://github.com/openresty/ngx_openresty/blob/master/util/configure
RUN apk update \
&& apk add make gcc musl-dev \
pcre-dev openssl-dev zlib-dev ncurses-dev readline-dev \
curl perl
RUN mkdir -p /root/ngx_openresty \
&& cd /root/ngx_openresty \
&& echo "==> Downloading OpenResty..." \
&& curl -sSL http://openresty.org/download/ngx_openresty-${OPENRESTY_VERSION}.tar.gz | tar -xvz \
&& cd ngx_openresty-* \
&& echo "==> Configuring OpenResty..." \
&& readonly NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \
&& echo "using upto $NPROC threads" \
&& ./configure \
--prefix=$OPENRESTY_PREFIX \
--http-client-body-temp-path=$VAR_PREFIX/client_body_temp \
--http-proxy-temp-path=$VAR_PREFIX/proxy_temp \
--http-log-path=$VAR_PREFIX/access.log \
--error-log-path=$VAR_PREFIX/error.log \
--pid-path=$VAR_PREFIX/nginx.pid \
--lock-path=$VAR_PREFIX/nginx.lock \
--with-luajit \
--with-pcre-jit \
--with-ipv6 \
--with-http_gzip_static_module \
--with-http_ssl_module \
--without-http_ssi_module \
--without-http_userid_module \
--without-http_fastcgi_module \
--without-http_uwsgi_module \
--without-http_scgi_module \
--without-http_memcached_module \
-j${NPROC} \
&& echo "==> Building OpenResty..." \
&& make -j${NPROC} \
&& echo "==> Installing OpenResty..." \
&& make install \
&& echo "==> Finishing..." \
&& ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/nginx \
&& ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/openresty \
&& ln -sf $OPENRESTY_PREFIX/bin/resty /usr/local/bin/resty \
&& ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* $OPENRESTY_PREFIX/luajit/bin/lua \
&& ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* /usr/local/bin/lua \
&& apk del \
pcre-dev openssl-dev zlib-dev ncurses-dev readline-dev curl perl \
&& apk add \
libpcrecpp libpcre16 libpcre32 openssl libssl1.0 pcre libgcc libstdc++ \
&& rm -rf /var/cache/apk/* \
&& rm -rf /root/ngx_openresty
RUN apk add --update lua5.1-dev unzip && export C_INCLUDE_PATH=/usr/include/lua5.1/
RUN wget -qO- http://luarocks.org/releases/luarocks-2.3.0.tar.gz | tar xvz -C /tmp/ \
&& cd /tmp/luarocks-* \
&& ./configure --with-lua=/opt/openresty/luajit \
--with-lua-include=/opt/openresty/luajit/include/luajit-2.1 \
--with-lua-lib=/opt/openresty/lualib \
&& make bootstrap \
&& rm -rf /tmp/luarocks-*
RUN luarocks install lua-cjson
RUN apk del \
lua5.1-dev unzip make gcc musl-dev
WORKDIR $NGINX_PREFIX/
CMD ["nginx", "-g", "daemon off; error_log /dev/stderr info;"]