#pcre OpenSSL OpenResty lua Resty
FROM centos:7.3.1611
RUN yum update -y && yum install -y wget make gcc gcc-c++ unzip git patch readline-devel \
bzip2 zlib zlib-devel
ENV BUILD_PATH=/tmp/build
RUN mkdir --verbose -p "BUILD_PATH"
ENV PCRE_VERSION=8.43
RUN cdBUILD_PATH && \
wget "https://ftp.pcre.org/pub/pcre/pcre-PCRE_VERSION.tar.gz" && \
tar zxf pcre-PCRE_VERSION.tar.gz
ENV OPENSSL_VERSION=1.0.2k
RUN cd BUILD_PATH && \
wget "https://www.openssl.org/source/openssl-OPENSSL_VERSION.tar.gz" && \
tar zxf openssl-OPENSSL_VERSION.tar.gz
ENV OPENRESTY_VERSION=1.13.6.2
RUN cdBUILD_PATH && \
wget "https://openresty.org/download/openresty-OPENRESTY_VERSION.tar.gz" && \
tar zxf openresty-OPENRESTY_VERSION.tar.gz
RUN cd BUILD_PATH/openssl-OPENSSL_VERSION && \
patch -p1 < BUILD_PATH/openresty-OPENRESTY_VERSION/patches/openssl-1.0.2h-sess_set_get_cb_yield.patch && \
cd BUILD_PATH/openresty-OPENRESTY_VERSION && \
./configure \
--with-http_realip_module \
--with-http_stub_status_module \
--without-mail_pop3_module \
--without-mail_smtp_module \
--without-mail_imap_module \
--without-http_uwsgi_module \
--without-http_scgi_module \
--with-openssl=../openssl-OPENSSL_VERSION \
--with-pcre=../pcre-PCRE_VERSION \
--with-pcre-jit && \
make -j8 && \
make install
ENV LUA_RESTY_BALANCER_VERSION=0.02rc5
RUN cd BUILD_PATH && \
wget "https://github.com/openresty/lua-resty-balancer/archive/vLUA_RESTY_BALANCER_VERSION.tar.gz" && \
tar zxf vLUA_RESTY_BALANCER_VERSION.tar.gz && \
cd lua-resty-balancer-LUA_RESTY_BALANCER_VERSION && \
make all && make install
ENV LUA_RESTY_COOKIE_VERSION=0.1.0
RUN cd BUILD_PATH && \
wget "https://github.com/cloudflare/lua-resty-cookie/archive/vLUA_RESTY_COOKIE_VERSION.tar.gz" && \
tar zxf vLUA_RESTY_COOKIE_VERSION.tar.gz && \
cd lua-resty-cookie-0.1.0 && make install
RUN yum clean all && rm -frBUILD_PATH
ADD . /
CMD ["/package.sh"]