#!/bin/bash#前提条件:默认已经安装好dockerce,docker-compose,laradock_db_host='mysql'_db_name='fastadmin1'_db_user='root'_db_passwd='root'_db_port='3306'_project_container_root_dir='/var/www/sw.aa'_git_addr='https://gitee.com/karson/fastadmin.git'_laradock_root='/mnt/hgfs/www/laradock'_project_root_dir='/mnt/hgfs/www/sw.aa'source /etc/profilefunction up_laradock() { cd ${_laradock_root} docker-compose up -d mysql nginx workspace # docker-compose exec workspace bash # npm install bower -g}cat > ${_project_root_dir}'/build.sh' << EOF#!/bin/bashfunction cd_project_root() { cd ${_project_container_root_dir}}function pull_project() { cd_project_root apt -y install git && git init && git remote add origin ${_git_addr} && git pull origin master}function package_install() { npm install bower -g bower install --allow-root composer install}function cp_env() { cp -f .env.sample .env sed -i 's/hostname = 127.0.0.1/hostname = '${_db_host}'/g' .env sed -i 's/database = fastadmin/database = '${_db_name}'/g' .env sed -i 's/username = root/username = '${_db_user}'/g' .env sed -i 's/password = root/password = '${_db_passwd}'/g' .env sed -i 's/hostport = 3306/hostport = '${_db_port}'/g' .env}function setup_project() { php think install -u ${_db_user} -p ${_db_passwd} echo 'install complete!'}# cd_project_rootpull_projectpackage_installcp_envsetup_projectEOFfunction build_in_container() { docker-compose exec workspace ${_project_container_root_dir}/build.sh}up_laradockbuild_in_container
希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 iCMS, Fastadmin, ClassCMS, LeCMS, PbootCMS, PHPCMS, 易优CMS, YzmCMS, 讯睿CMS, 极致CMS, Wordpress, HkCMS, YznCMS, WellCMS, ThinkCMF, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。