|
| 1 | +FROM ubuntu:14.04.2 |
| 2 | + |
| 3 | +RUN apt-get update \ |
| 4 | + && apt-get install -y --no-install-recommends \ |
| 5 | + curl perl make build-essential procps \ |
| 6 | + libreadline-dev libncurses5-dev libpcre3-dev libssl-dev \ |
| 7 | + && rm -rf /var/lib/apt/lists/* |
| 8 | + |
| 9 | +ENV OPENRESTY_VERSION 1.7.7.1 |
| 10 | +ENV OPENRESTY_PREFIX /opt/openresty |
| 11 | +ENV NGINX_PREFIX /opt/openresty/nginx |
| 12 | +ENV VAR_PREFIX /var/nginx |
| 13 | + |
| 14 | +# NginX prefix is automatically set by OpenResty to $OPENRESTY_PREFIX/nginx |
| 15 | +# look for $ngx_prefix in https://github.com/openresty/ngx_openresty/blob/master/util/configure |
| 16 | + |
| 17 | +RUN cd /root \ |
| 18 | + && echo "==> Downloading OpenResty..." \ |
| 19 | + && curl -sSL http://openresty.org/download/ngx_openresty-${OPENRESTY_VERSION}.tar.gz | tar -xvz \ |
| 20 | + && echo "==> Configuring OpenResty..." \ |
| 21 | + && cd ngx_openresty-* \ |
| 22 | + && readonly NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \ |
| 23 | + && echo "using upto $NPROC threads" \ |
| 24 | + && ./configure \ |
| 25 | + --prefix=$OPENRESTY_PREFIX \ |
| 26 | + --http-client-body-temp-path=$VAR_PREFIX/client_body_temp \ |
| 27 | + --http-proxy-temp-path=$VAR_PREFIX/proxy_temp \ |
| 28 | + --http-log-path=$VAR_PREFIX/access.log \ |
| 29 | + --error-log-path=$VAR_PREFIX/error.log \ |
| 30 | + --pid-path=$VAR_PREFIX/nginx.pid \ |
| 31 | + --lock-path=$VAR_PREFIX/nginx.lock \ |
| 32 | + --with-luajit \ |
| 33 | + --with-pcre-jit \ |
| 34 | + --with-ipv6 \ |
| 35 | + --with-http_ssl_module \ |
| 36 | + --without-http_ssi_module \ |
| 37 | + --without-http_userid_module \ |
| 38 | + --without-http_fastcgi_module \ |
| 39 | + --without-http_uwsgi_module \ |
| 40 | + --without-http_scgi_module \ |
| 41 | + --without-http_memcached_module \ |
| 42 | + -j${NPROC} \ |
| 43 | + && echo "==> Building OpenResty..." \ |
| 44 | + && make -j${NPROC} \ |
| 45 | + && echo "==> Installing OpenResty..." \ |
| 46 | + && make install \ |
| 47 | + && echo "==> Finishing..." \ |
| 48 | + && ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/nginx \ |
| 49 | + && ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/openresty \ |
| 50 | + && ln -sf $OPENRESTY_PREFIX/bin/resty /usr/local/bin/resty \ |
| 51 | + && ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* $OPENRESTY_PREFIX/luajit/bin/lua \ |
| 52 | + && ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* /usr/local/bin/lua \ |
| 53 | + && rm -rf /root/ngx_openresty* |
| 54 | + |
| 55 | +WORKDIR $NGINX_PREFIX/ |
| 56 | + |
| 57 | +ONBUILD RUN rm -rf conf/* html/* |
| 58 | +ONBUILD COPY nginx $NGINX_PREFIX/ |
| 59 | + |
| 60 | +CMD ["nginx", "-g", "daemon off; error_log /dev/stderr info;"] |
0 commit comments