Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker Development Environment of Laravel-based on centos system

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1 Planning software: PHP 7.2, Nginx, MySQL, Composer, NPM AND Yarn, etc. It is easy to expand and use, such as switching PHP versions at any time, or switching between Apache and Nginx. Plan: first install the php-fpm and laravel dependency packages in the centos image, use supervisord to monitor the startup of php-fpm, and then mount the project directory into the container to execute the script to build the project. Implement project release and update iterations. Here I only deal with the php and dependency environment of lavravel, not the environment of nginx and mysql. I will work on other dependent environments later.

2 deployment of the required installation package php-fpm 7.2 I am lazy and easy to install directly in the container (open module: 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 Swoolenode I choose node-v10.10.0-linux-x64.tar.gz wget https://nodejs.org/download/release/v10.10.0/node-v10.10.0-linux-x64.tar.gztar xf node-v10.10.0-linux-x64.tar.gz mv node-v10.10.0 / usr/local/nodeyarnwget install-y https://github.com/yarnpkg/yarn/releases/download/v1.13.0/yarn-1.13.0 here -1.noarch.rpmyum install-y yarn-1.13.0-1.noarch.rpm install nodejs 8 curl-sL https://rpm.nodesource.com/setup_8.x | bash-install composecd / usr/local/bincurl-s https://getcomposer.org/installer | phpchmod aquix composer.phar composer.phar self-update mv composer.phar composer supervisor install yum install-y epel-release yum install-y supervisor configuration environment startup script and supervisor launch configuration [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 logfile; 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; (loglevel; 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)% (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 after processing, delete the installation package and clean up the yum cache as an image 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 package as an image laravel environment docker commit-a "laravel environment initialization" 58b32f9d29d0 hanye131/fangxinerp:supvisor_php- Fpm72 starts the image 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 simulation project starts 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: Hanye131According to fangxinerpsupvisorphpMurfpm72androotandlaravelMurinstall.shangye131According to bin 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 devDockerfileFROM centos:latestMAINTAINER hz7726@163.comENV PATH / usr/local/php/bin:/usr/local/php/sbin:/usr/local/node/bin:$PATHRUN 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 updated functions @ Disable_functions@' / usr/local/php/etc/php.ini\ & & rm-fr / data/docker & & yum cleal allCMD ['/ 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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report