1.构建nginx镜像
# Base image FROM centos:7 # MAINTAINER MAINTAINER cbmiao <[email protected]> # 将nginx以及pcre源代码加入镜像 ADD nginx-1.20.1.tar.gz /usr/local/src/ ADD pcre-8.45.tar.gz /usr/local/src/ # 安装编译器 RUN yum install -y gcc gcc-c++ make openssl-devel lsof RUN useradd -s /sbin/nologin -M nginx # 指定工作目录 WORKDIR /usr/local/src/nginx-1.20.1/ # 编译nginx RUN ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.45 && make && make install RUN echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf # 设置环境变量 ENV PATH /usr/local/nginx/sbin:$PATH # 暴露80端口 EXPOSE 80 # 容器默认启动命令 ENTRYPOINT ["nginx"]
wget http://nginx.org/download/nginx-1.20.1.tar.gz
wget http://downloads.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz
标签:pcre,tar,nginx,--,语法,Dockefile,usr,镜像,local From: https://www.cnblogs.com/cherishthepresent/p/17417400.html