简介
- 官网地址:https://openresty.org/en/
- 源码下载地址:https://openresty.org/en/download.html
- 编译方法:https://openresty.org/en/installation.html#building-from-source
通过 docker 实现自动化编译
FROM centos:centos7.9.2009
MAINTAINER yupd
ARG openresty_ver="1.21.4.1"
ARG openssl_ver="1.1.1u"
ARG pcre_ver="8.44"
ARG zlib_ver="1.2.13"
RUN yum -y install wget make gcc gcc-c++ perl-devel
RUN cd /usr/src \
&& wget https://www.openssl.org/source/openssl-${openssl_ver}.tar.gz --no-check-certificate \
&& tar -zxf openssl-${openssl_ver}.tar.gz \
&& wget https://www.zlib.net/zlib-${zlib_ver}.tar.gz \
&& tar -zxf zlib-${zlib_ver}.tar.gz \
&& wget https://ftp.exim.org/pub/pcre/pcre-${pcre_ver}.tar.gz --no-check-certificate \
&& tar -zxf pcre-${pcre_ver}.tar.gz \
&& wget https://openresty.org/download/openresty-${openresty_ver}.tar.gz --no-check-certificate \
&& tar -zxf openresty-${openresty_ver}.tar.gz \
&& cd openresty-${openresty_ver} \
&& ./configure --prefix=/usr/local/openresty \
--with-openssl=/usr/src/openssl-${openssl_ver} \
--with-pcre=/usr/src/pcre-${pcre_ver} \
--with-zlib=/usr/src/zlib-${zlib_ver} \
--with-http_sub_module \
--with-luajit \
&& make -j5 \
&& make install
docker build -t openresty-builder -f Dockerfile .
docker run --rm -v $PWD:/work --name=openresty-builder-container openresty-builder \
sh -c "cd /usr/local && tar -zcf openresty.tar.gz openresty && mv openresty.tar.gz /work/"
tar -zxf openresty.tar.gz -C /usr/local