安装包请见 https://www.jianshu.com/p/b81656764613
Dockerfile
#FROM ubuntu
FROM centos
MAINTAINER G00G1S
COPY nginx-1.16.0 /usr/local/src/nginx-1.16.0
COPY LuaJIT-2.0.5 /usr/local/LuaJIT-2.0.5
COPY ngx_devel_kit-0.3.0 /usr/local/ngx_devel_kit-0.3.0
COPY lua-nginx-module-0.10.9rc7 /usr/local/lua-nginx-module-0.10.9rc7
COPY openssl-1.0.2r /usr/local/openssl-1.0.2r
COPY pcre-8.40 /usr/local/pcre-8.40
COPY perl-5.14.2 /usr/local/perl-5.14.2
RUN yum install -y gcc gcc-c++ glibc make autoconf lua-socket
RUN /usr/bin/yum install -y libxslt-devel -y gd gd-devel GeoIP GeoIP-devel pcre pcre-devel
RUN cd /usr/local/LuaJIT-2.0.5 && make && make install PREFIX=/usr/local/LuaJIT
WORKDIR /usr/local/src/nginx-1.16.0
RUN export LUAJIT_LIB=/usr/local/LuaJIT/lib && \
export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0 && \
./configure \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_gzip_static_module \
--with-ipv6 \
--with-http_sub_module \
--with-openssl=/usr/local/openssl-1.0.2r \
--add-module=/usr/local/ngx_devel_kit-0.3.0 \
--add-module=/usr/local/lua-nginx-module-0.10.9rc7 \
--with-pcre=/usr/local/pcre-8.40 && make && make install
COPY nginx.conf /usr/local/nginx/conf/nginx.conf
RUN echo "/usr/local/LuaJIT/lib" >> /etc/ld.so.conf && ldconfig
COPY waf /usr/local/nginx/conf/waf
RUN ln -sf /dev/stdout /usr/local/nginx/logs/access.log
RUN ln -sf /dev/stderr /usr/local/nginx/logs/error.log
EXPOSE 80
COPY run.sh /root/run.sh
RUN chmod +x /root/run.sh
CMD ["/root/run.sh"]
run.sh
#!/bin/bash
/usr/local/nginx/sbin/nginx -g "daemon off;"
网友评论