DockerFile部署OpenResty+Lua

FROM centos:7

ENV openresty_version 1.17.8.2
ENV luarock_version 2.0.13
ENV ngx_file /usr/local/openresty/nginx/conf/
ENV ngx_code /usr/local/openresty/nginx/

COPY openresty-$openresty_version.tar.gz /opt/
COPY luarocks-$luarock_version.tar.gz /opt/

WORKDIR /opt
RUN tar -xf openresty-${openresty_version}.tar.gz && \
yum -y install pcre-devel perl libxml2-devel bzip2-devel libcurl-devel net-tools gcc gcc-c++ openssl openssl-devel lua-luaossl lua-devel unzip

WORKDIR /opt/openresty-${openresty_version}
RUN ./configure --prefix=/usr/local/openresty && make && make install

WORKDIR /opt
RUN tar -xf luarocks-$luarock_version.tar.gz

WORKDIR /opt/luarocks-$luarock_version
RUN ./configure --prefix=/usr/local/openresty/luajit --with-lua=/usr/local/openresty/luajit/ --lua-suffix=jit --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 && make && make install && \
ln -s /usr/local/openresty/luajit/bin/luarocks /usr/bin/luarocks && \
luarocks install bit32 && \
luarocks install xxtea && \
luarocks install lua-protobuf && \

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

======================================
FROM engine:v2

ENV ngx_file /usr/local/openresty/nginx/conf
ENV ngx_code /usr/local/openresty/nginx

RUN mkdir -p $ngx_code/test && \
    mkdir -p $ngx_code/data


COPY lua $ngx_code/lua
COPY lualib $ngx_code/lualib
COPY conf $ngx_file
COPY data $ngx_code/data
COPY test $ngx_code/test

USER root

WORKDIR /usr/local/openresty/nginx

VOLUME /usr/local/openresty/nginx/logs

EXPOSE 8090

ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx"]
CMD ["-g","daemon off;"]

  


  

 

  

posted @ 2022-08-29 15:28  张祺  阅读(426)  评论(0)    收藏  举报