Nginx Dockerfile # # Version 1.0 # author fendo # base image Base Images the FROM CentOS: centos7 #FROM hub.c. 163 .com / netease_comb / CentOS: . 7 # installation of dependencies the RUN yum - Y Update the RUN yum -Y the install GCC GCC - autoconf automake ++ c the make RUN yum -y install zlib zlib-devel PCRE OpenSSL * * wget lua- devel #MAINTAINER maintainer information mAINTAINER fendo [email protected] #add obtain the url of the file, the current directory under the ADD HTTP: / /nginx.org/download/nginx-1.14.0.tar.gz / tmp / #LuaJIT 2.1 #add HTTP: // luajit.org/download/LuaJIT-2.0.5.tar.gz / tmp / the ADD HTTPS: // github.com/LuaJIT/LuaJIT/archive/v2.0.5.tar.gz / tmp / #ngx_devel_kit (the NDK) block the ADD HTTPS: // github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz / tmp / # Lua-nginx- module module the ADD HTTPS: // github.com/openresty/lua-nginx-module/archive/v0.10.13.tar.gz / tmp / #nginx ngx_cache_purge module the ADD HTTP: // labs.frickle. COM / Files / ngx_cache_purge-2.3.tar.gz / tmp / # directory switching the WORKDIR / tmp # mounting LuaJIT2.0.5 #RUN wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz -P /tmp/ RUN tar zxf v2.0.5.tar.gz WORKDIR /tmp/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 the RUN CP -R & lt ngx_devel_kit- 0.3 . 0 / / usr / local / the src / # mounted Lua -nginx- Module1 module the RUN the tar -xzvf V0. 10.13 . the tar .gz the RUN CP -R & lt Lua-Nginx-module- 0.10 . 13 is / / usr / local / the src / # module mounted nginx ngx_cache_purge the RUN the tar -xzvf ngx_cache_purge- 2.3 . the tar .gz the RUN CP -R & lt ngx_cache_purge- 2.3 / / usr / local / the src / # setting environment variables the 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} #编译安装Nginx RUN useradd -M -s /sbin/nologin nginx RUN tar -zxvf nginx-1.14.0.tar.gz RUN mkdir -p /usr/local/nginx RUN cd /tmp/nginx-1.14.0 \ && ./configure --prefix=/etc/nginx --user=nginx --group=nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock \ --with-ld-opt="-Wl,-rpath,/usr/local/luajit/lib" \ --with-http_stub_status_module \ --with-http_ssl_module \ --with-http_sub_module \ --add-module=/usr/local/src/lua-nginx-module-0.10.13 \ --add-module=/usr/local/src/ngx_devel_kit-0.3.0 \ --add-module=/usr/local/src/ngx_cache_purge-2.3 \ && the make && the make install # Parameter # - prefix is used to specify the directory to compile and install nginx # --add- Module for third-party modules added, the addition of fdfs of nginx module # - with .. ._module represent enabled nginx module, so at http_ssl_module enabled module RUN / etc / nginx / sbin / nginx -c / etc / nginx / nginx.conf RUN LN -s / usr / local / nginx / sbin / * / usr / local / sbin / #EXPOSE port mapping EXPOSE 80 443 #CMD run the following command #CMD [ "Nginx"] the CMD [ "/ etc / Nginx / sbin / Nginx", "- G", "OFF daemon;"]