Docker:openresty镜像构建

一.前言

OpenResty 是一个强大的 Web 应用服务器,Web 开发人员可以使用 Lua 脚本语言调动 Nginx 支持的各种 C 以及 Lua 模块,更主要的是在性能方面,OpenResty可以 快速构造出足以胜任 10K 以上并发连接响应的超高性能 Web 应用系统。

没用过OpenResty 的同学不用担心,把它当做nginx就行

OpenResty官网: http://openresty.org/cn/

二.Dockerfile制作过程

1.百度网盘下载data.tar.gz文件

链接:https://pan.baidu.com/s/1-LC1QxsTwKJQaJm-xx2Szw
提取码:xquj

2.Dockerfile文件

FROM centos:centos7
MAINTAINER jeff
ENV TIME_ZOME=Asia/Shanghai
ENV OPENRESTY_VERSION=1.15.8.2
ADD data.tar.gz  /opt/data
RUN yum install -y gcc-c++ make  perl pcre-devel openssl-devel gcc curl postgresql-devel  curl &&\
     cd /opt/data/&&tar  -zxvf  openresty-${OPENRESTY_VERSION}.tar.gz &&cd openresty-${OPENRESTY_VERSION} &&\
   ./configure --prefix=/opt/openresty    --with-http_sub_module --with-luajit\
                         --without-http_redis2_module  --with-http_iconv_module\
--with-http_postgres_module && make -j 4 && make install &&\ cd -&&tar -zxvf inotify-tools-3.14.tar.gz &&cd inotify-tools-3.14&&./configure --prefix=/opt/inotify && make && make install&&\ echo "${TIME_ZOME}" > /etc/timezone &&cd /opt/openresty&&\ mkdir /opt/openresty/nginx/conf/vhost &&\ mv /opt/data/nginx.conf /opt/openresty/nginx/conf/nginx.conf &&\ mv /opt/data/*.sh /opt/openresty/&&chmod +x /opt/openresty/*.sh&&\ ln -sf /usr/share/zoneinfo/${TIME_ZOME} /etc/localtime&&yum clean all &&rm -rf /opt/data&&\ mkdir -p /data/www/&&mkdir -p /data/logs/ ENV PATH $PATH:/opt/openresty/nginx/sbin WORKDIR /opt/openresty/ EXPOSE 80 EXPOSE 443 CMD ["./start.sh"]

 镜像说明:

配置文件目录 /opt/openresty/nginx/conf/vhost

修改vhost 站点配置后,无须重启openresty,openresty会自动重载配置

 

posted @ 2020-04-10 14:31  人生是一场修行  阅读(1145)  评论(0编辑  收藏  举报