您好,登錄后才能下訂單哦!
軟件:PHP 7.2、Nginx、MySQL、Composer、NPM AND Yarn 等等;
易于擴(kuò)展使用,如隨時(shí)可以切換 PHP 版本,或者 Apache 和 Nginx 切換使用。
規(guī)劃: 先在centos鏡像安裝php-fpm和laravel的需要依賴包,使用supervisord監(jiān)控php-fpm的啟動(dòng),然后通過掛載項(xiàng)目的目錄到容器之內(nèi) 執(zhí)行腳本構(gòu)建項(xiàng)目。實(shí)現(xiàn)項(xiàng)目發(fā)布和更新迭代。
此處我僅僅處理了lavravel的php和依賴環(huán)境,并沒有處理nginx和mysql的環(huán)境,后期會(huì)出關(guān)于其他依賴的環(huán)境的操作。
我這里懶省事直接在容器里面安裝處理了(開啟模塊: 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 環(huán)境初始化" 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
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。