#Base images FROM centos:7 #Maintainer MAINTAINER jieyue #Commands # Start install nginx ENV PROJECT_DIR=/usr/local/src/ WORKDIR $PROJECT_DIR RUN yum install epel-release -y RUN yum install -y gcc lsof net-tools sysstat gcc-c++ gd-devel readline-devel pcre-devel openssl-devel gmake perl iputils curl autoconf automake zlib zlib-devel op enssl openssl-devel pcre pcre-devel wget lua-devel ADD nginx-1.16.1.tar.gz /usr/local/src ADD nginx-module-vts-0.1.18.tar.gz /usr/local/src RUN mv nginx-module-vts-0.1.18 nginx-module-vts ADD ngx_realtime_request_module.tar.gz /usr/local/src WORKDIR /usr/local/src/nginx-1.16.1 #LuaJIT 2.1 #ADD http://luajit.org/download/LuaJIT-2.0.5.tar.gz /usr/local/src #ADD https://github.com/LuaJIT/LuaJIT/archive/v2.0.5.tar.gz /usr/local/src #ngx_devel_kit(NDK)模块 #ADD https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz /usr/local/src #lua-nginx-module 模块 #ADD https://github.com/openresty/lua-nginx-module/archive/v0.10.13.tar.gz /usr/local/src #nginx ngx_cache_purge模块 #ADD http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz /usr/local/src #安装LuaJIT 2.0.5 #RUN wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz . #RUN tar zxf v2.0.5.tar.gz #WORKDIR /usr/local/src/LuaJIT-2.0.5 #RUN cd LuaJIT-2.0.5 #RUN make PREFIX=/usr/local/luajit #RUN make install PREFIX=/usr/local/luajit #安装ngx_devel_kit(NDK) #WORKDIR /tmp #RUN tar -xzvf v0.3.0.tar.gz #RUN cp -r ngx_devel_kit-0.3.0/ /usr/local/src/ #安装lua-nginx-module模块 #RUN tar -xzvf v0.10.13.tar.gz #RUN cp -r lua-nginx-module-0.10.13/ /usr/local/src/ #安装nginx ngx_cache_purge模块 #RUN tar -xzvf ngx_cache_purge-2.3.tar.gz #RUN cp -r ngx_cache_purge-2.3/ /usr/local/src/ #设置环境变量 #RUN export LUAJIT_LIB=/usr/local/lib #RUN export LUAJIT_INC=/usr/local/include/luajit-2.0 #RUN mkdir -p {/usr/local/nginx/logs,/var/lock} RUN /usr/sbin/useradd jyapp RUN ./configure --prefix=/usr/local/nginx --user=jyapp --group=jyapp --with-http_ssl_module --with-http_flv_module --with-http_dav_module --with-http_sub_module -- pid-path=/usr/local/nginx/conf/nginx.pid --error-log-path=/usr/local/logs/error.log --http-log-path=/usr/local/logs/access.log --with-http_gzip_static_module --htt p-client-body-temp-path=/var/temp/nginx/client --with-http_stub_status_module --http-proxy-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx /fastcgi --http-uwsgi-temp-path=/var/temp/nginx/uwsgi --http-scgi-temp-path=/var/temp/nginx/scgi --with-stream --add-module=/usr/local/src/nginx-module-vts --add-m odule=/usr/local/src/ngx_realtime_request_module RUN make && make install RUN mkdir -p /var/temp/nginx && mkdir -p /usr/local/nginx/temp && mkdir -p /usr/local/nginx/conf/conf.d && mkdir -p /usr/local/nginx/conf/upstream && mkdir -p /var /www/html && rm -f /usr/local/nginx/conf/nginx.conf WORKDIR $PROJECT_DIR COPY ./nginx.conf /usr/local/nginx/conf/ COPY ./index.html /var/www/html/ EXPOSE 80 443 CMD ["/usr/local/nginx/sbin/nginx","-g","daemon off;"]
由到现有的K8S集群使用的基于openresty的编译时模块有限,所以支持功能相对较弱,现依据tengine编译并增加了nginx-vts模块便于监控,打开了原生tcp代理功能,lua模暂时未加载。