软件:PHP 7.2、Nginx、MySQL、Composer、NPM AND Yarn 等等;
易于扩展使用,如随时可以切换 PHP 版本,或者 Apache 和 Nginx 切换使用。
规划: 先在centos镜像安装php-fpm和laravel的需要依赖包,使用supervisord监控php-fpm的启动,然后通过挂载项目的目录到容器之内 执行脚本构建项目。实现项目发布和更新迭代。
此处我仅仅处理了lavravel的php和依赖环境,并没有处理nginx和mysql的环境,后期会出关于其他依赖的环境的操作。
成都创新互联专注为客户提供全方位的互联网综合服务,包含不限于成都做网站、网站制作、瓜州网络推广、微信平台小程序开发、瓜州网络营销、瓜州企业策划、瓜州品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;成都创新互联为所有大学生创业者提供瓜州建站搭建服务,24小时服务热线:028-86922220,官方网址:www.cdcxhl.com
我这里懒省事直接在容器里面安装处理了(开启模块: opcache imagick fileinfo redis swoole )
wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --php_option 7 --phpcache_option 1 --php_extensions zendguardloader,ioncube,imagick,fileinfo,redis,swoole
我这里选择 node-v10.10.0-linux-x64.tar.gz
wget https://nodejs.org/download/release/v10.10.0/node-v10.10.0-linux-x64.tar.gz
tar xf node-v10.10.0-linux-x64.tar.gz
mv node-v10.10.0 /usr/local/node
wget install -y https://github.com/yarnpkg/yarn/releases/download/v1.13.0/yarn-1.13.0-1.noarch.rpm
yum install -y yarn-1.13.0-1.noarch.rpm
curl -sL https://rpm.nodesource.com/setup_8.x | bash -
cd /usr/local/bin
curl -s https://getcomposer.org/installer | php
chmod a+x composer.phar
composer.phar self-update
mv composer.phar composer
yum install -y epel-release
yum install -y supervisor
[root@58b32f9d29d0 /]# cat /root/startphp-fpm.sh
#!/bin/bash
supervisord -n -c /etc/supervisord.conf
[root@58b32f9d29d0 /]# cat /etc/supervisord.conf |grep -vE "^;|^$"
[unix_http_server]
file=/var/run/supervisor/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor/supervisor.sock ; use a unix:// URL for a unix socket
[program:php-fpm]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/php/sbin/php-fpm --fpm-config /usr/local/php/etc/php-fpm.conf
#stdout_logfile=/data/wwwlogs/php-fpm-sup.log
autostart=true
autorestart=true
startretries=5
exitcodes=0,2,70
stopsignal=QUIT
stopwaitsecs=2
[include]
files = supervisord.d/*.ini
rm -fr oneinstack-full.tar.gz oneinstack yarn-1.13.0-1.noarch.rpm node-v10.10.0-linux-x64.tar.gz
yum cleal all
docker commit -a "laravel 环境初始化" 58b32f9d29d0 hanye131/fangxinerp:supvisor_php-fpm72
docker run -itd --name=test1 -v /data/startphp-fpm.sh:/root/startphp-fpm.sh -v /data/supervisord.conf:/etc/supervisord.conf hanye131/fangxinerp:supvisor_php-fpm72
docker run -itd --name=test1 -v /data/startphp-fpm.sh:/root/startphp-fpm.sh -v /data/supervisord.conf:/etc/supervisord.conf -v /var/www/html:/var/www/html -v /root/laravel-install.sh:/root/laravel-install.sh: hanye131/fangxinerp:supvisor_php-fpm72
#!/bin/bash
export PATH=/usr/local/php/bin:/usr/local/php/sbin:/usr/local/node/bin:$PATH
cd /var/www/html
composer install
yarn install
php artisan migrate --force
php artisan queue:restart
npm run dev
FROM centos:latest
MAINTAINER hz7726@163.com
ENV PATH /usr/local/php/bin:/usr/local/php/sbin:/usr/local/node/bin:$PATH
RUN yum install -y wget \
&& mkdir -p /data/docker \
&& cd /data/docker \
&& wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --php_option 7 --phpcache_option 1 --php_extensions zendguardloader,imagick,fileinfo,redis,swoole \
&& wget https://nodejs.org/download/release/v10.10.0/node-v10.10.0-linux-x64.tar.gz \
&& tar xf node-v10.10.0-linux-x64.tar.gz \
&& mv node-v10.10.0-linux-x64 /usr/local/node \
&& curl -sL https://rpm.nodesource.com/setup_8.x | bash - \
&& wget https://github.com/yarnpkg/yarn/releases/download/v1.13.0/yarn-1.13.0-1.noarch.rpm \
&& yum install -y yarn-1.13.0-1.noarch.rpm
COPY php_etc.tar.gz /usr/local/php/etc/
RUN cd /usr/local/php/etc/ \
&& tar xf php_etc.tar.gz
#COPY /data/php-fpm /etc/init.d/php-fpm
#COPY /data/composer /usr/local/bin/composer
#RUN chmod +x /etc/init.d/php-fpm \
#&& chkconfig --add php-fpm \
&& sed -i 's@disable_functions@;disable_functions@' /usr/local/php/etc/php.ini\
&& rm -fr /data/docker && yum cleal all
CMD ['/usr/local/php/sbin/php-fpm','--fpm-config','/usr/local/php/etc/php-fpm.conf']
https://gitee.com/hanyehell/DockerInstall/tree/master/docker-Laravel-php-fpm