from centos:7maintainer carl <[email protected]>#=================================== = Resolve Dependency ============================================env nginx_version 1.10.2env php_version 7.0.12ENV LIBICONV_VERSION 1.14RUN yum -y install bzip* libm* mhash* imagemagick* php-pear* php-devel* autoconf automake openssh Libiconv* libreoffice-headless libreoffice-writer lua* libtool cmake make --skip-broken && yum clean all#======================================= ====================================================== #RUN rpm -ivh http://dl.fedoraproject.org /pub/epel/7server/x86_64/e/epel-release-7-8.noarch.rpm && yum install -y wget wget zlib-devel zlib* python-setuptools openssh* libmcrypt* freetype-devel libpng-devel libjpeg-devel pcre-devel lrzsz* gcc* image* openoffice* libxslt-devel freetype-devel libpng-devel libcurl-devel openldap* postgresql-devel curl-devel bzip2-devel libjpeg-devel readline-devel Libmcrypt* glibc* libcurl* screen tree lsof htop iptraf sysstat inotify-tools htopmcrypt* libevent* libxml2* post* pcre* gcc-c++ && yum clean all#==================================== installation nginx && php7=========================================RUN groupadd -r www && useradd -m -s /sbin/nologin -r -g www www#download nginx libiconv and php7,libiconv1.14 Version exists bugrun mkdir -p /usr/local/src/ nginx-php && cd $_ && wget -c -o nginx.tar.gz http://nginx.org/download/nginx-$NGINX _ version.tar.gz && wget -o php.tar.gz http://php.net/distributions/php-$PHP _ version.tar.gz && wget -c -o libiconv.tar.gz http://ftp.gnu.org/pub/gnu/ Libiconv/libiconv-1.14.tar.gz && curl -o -sl https://github.com/xdebug/xdebug /archive/xdebug_2_4_0rc3.tar.gz#make install nginx run cd /usr/local/src/ nginx-php && tar -zxvf nginx.tar.gz && cd nginx-$NGINX _ version && ./configure --prefix=/usr/ local/nginx --user=www --group=www --error-log-path=/var/log/nginx_error.log --http-log-path=/var/log/nginx_access.log --pid-path=/var/run/ nginx.pid --with-pcre --with-http_ssl_module --without-mail_ pop3_module --without-mail_imap_module --with-http_gzip_static_module && make && make install#make install libiconv, There is a bug repairable #stdio.in.h found #_gl_warn_on_use (GET, "gets is a security hole - use fgets instead "); #注释掉 # Add # #ifdefined (__glibc__) &&!defined (__uclibc__) &&!__glibc_ Prereq (2,16) # _gl_warn_on_use (gets, "gets is a security hole - use fgets instead "); # #endIfrun cd /usr/local/src/nginx-php && tar -zxvf libiconv.tar.gz && cd libiconv-$LIBICONV _version && ./configure --prefix=/usr/ local/libiconv && make -j 4 && make install#make install php7run cd /usr/local/src/nginx-php && tar -zvxf php.tar.gz && cd php-$PHP _version && ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-fpm-user=www - -with-fpm-group=www --with-mcrypt=/usr/include --with-iconv=/usr/local/libiconv --with-mysqli --with-pdo-mysql --with-openssl --with-gd -- with-zlib --with-gettext --with-curl --with-png-dir --with-jpeg-dir --with-freetype-dir --with-xmlrpc -- with-mhash --with-openssl --enable-fpm --enable-xml --enable-shmop --enable-sysvsem -- enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-mysqlnd --enable-pcntl --enable-sockets --enable-zip -- enable-soap --enable-session --enable-opcache --enable-bcmath --enable-exif --enable-fileinfo --disable-rpath --disable-debug --without-pear & & make -j 4 && make install#======================================================================================================= # #Add xdebug extensionRUN cd /home/nginx-php && Tar -zxvf xdebug_2_4_0rc3.tar.gz && cd xdebug-xdebug_ 2_4_0rc3 && /usr/local/php/bin/phpize && ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config && make && cp modules/xdebug.so /usr/local/ php/lib/php/extensions/xdebug.sorun cd /home/nginx-php/php-$PHP _version && cp php.ini-production /usr/local/php/etc/php.ini && cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/ etc/php-fpm.conf && cp /usr/local/php/etc/php-fpm.d/ www.conf.default /usr/local/php/etc/php-fpm.d/www.conf##================================================= ====================================================== #Install supervisorRUN easy_install supervisor && mkdir -p /var/log/supervisor && mkdir -p /var/run/sshd && mkdir -p /var/run/ Supervisord#add supervisord confadd supervisord.conf /etc/supervisord.conf#create web foldervolume ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/USR/LOCAL/PHP/ETC/PHP.D"]add index.php /data/www/index.phpadd xdebug.ini /usr/ local/php/etc/php.d/xdebug.ini#update nginx configadd nginx.conf /usr/local/nginx/conf/ nginx.conf#======================== adding files to the container =============================== #StartADD start.sh / start.shrun chmod +x /start.sh#====================== Specifies that the container is mapped to the host's port ========================= #Set portexpose 8080 443 9000#======================================================== #Start itentrypoint ["/start.sh"]
#!/bin/sh########################################################################## file name: start.sh# author: timophy######################################################################### nginx_install_dir=/usr/local/nginxdata_dir=/data/wwwset -echown -r www.www $DATA _dirif [[ -n "$PROXY _web" ]]; then [ -f "${nginx_install_ Dir}/conf/ssl " ] | | mkdir -p $Nginx _install_dir/conf/ssl [ -f "${nginx_install_ Dir}/conf/vhost " ] | | mkdir -p $Nginx _install_dir/conf/vhost if [ -z "$PROXY _ DOMAIN " ]; then echo >&2 ' Error: missing proxy_domain ' echo >&2 ' did you forget to add -e proxy_domain=... ? ' exit 1 fi if [ -z "$PROXY _crt" ]; then echo >&2 ' ERROR:&NBSP;&NBSP;MISSING&NBSP;PROXY_CRT ' echo >&2 ' did you forget to add -e proxy_crt=... ? ' exit 1 fi if [ -z "$PROXY _key" ]; then echo >&2 ' Error: missing proxy_key ' echo >&2 ' did you forget to add -e proxy_key=... ? ' exit 1 fi if [ ! -f "${nginx_install_dir}/conf/ssl/${ PROXY_CRT} " ]; then echo >&2 ' ERROR:&NBSP;&NBSP;MISSING&NBSP;PROXY_CRT ' echo >&2 " you need to put ${proxy_crt} in ssl directory " exit 1 fi if [ ! -f "${nginx_install_dir}/conf/ssl/${proxy_key}" ]; then echo >&2 ' ERROR:&NBSP;&NBSP;MISSING&NBSP;PROXY_CSR ' echo >&2 " you need to put ${proxy_key} in ssl directory " exit 1 fi cat > ${nginx_install_dir}/conf/ vhost/website.conf << eofserver { listen 80; server_name $PROXY _domain; return 301 https://$PROXY _domain\ $request _uri; }server { listen 443 ssl; server_name $PROXY _domain; ssl on; ssl_certificate ssl/${proxy_crt}; ssl_certificate_key ssl/${proxy_key}; ssl_protocols  tlsv1 tlsv1.1 tlsv1.2; ssl_prefer_server_ciphers on; ssl_ciphers "Eecdh+aesgcm:edh+aesgcm:aes256+eecdh:aes256+edh"; keepalive_ Timeout 70; ssl_session_cache shared:ssl:10m; ssl_ session_timeout 10m; root $DATA _dir; index index.php index.html index.htm; location / { try_files \ $uri \ $uri/ /index.php?\ $args; } location ~ \.php$ { root /data/www; fastcgi_pass 127.0.0.1:9000; fastcgi_iNdex index.php; fastcgi_param script_ Filename /\ $document _root\ $fastcgi _script_name; include fastcgi_params; }}eoffi/usr/bin/ Supervisord -n -c /etc/supervisord.conf
This article from "Life, such as painting, Pen no regrets!" "Blog, reprint please contact the author!"
Dockerfile Automatic Deployment OPENRESTY+PHP7