1 Star 0 Fork 1

liuyibin23/frappe_docker

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
dbench 2.30 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
function run () {
user=$1
shift
docker exec -itu "${user}" frappe bash -c "$@"
}
if [[ $# -eq 0 ]]; then
docker exec -it frappe bash
elif [[ "$1" == 'init' ]]; then
run root "chown -R frappe:frappe /home/frappe"
run frappe "cd .. && bench init --frappe-branch version-12 frappe-bench --frappe-path https://gitee.com/liuyibin23/frappe.git --ignore-exist --skip-redis-config-generation && cd frappe-bench"
run frappe "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json && bench set-mariadb-host mariadb"
elif [[ "$1" == 'setup' ]]; then
if [[ "$2" == 'docker' ]]; then
if [[ "$3" == '--swarm-mode' ]]; then
echo "Docker swarm mode is not currently supported"
elif [[ "$3" == 'down' ]]; then
docker-compose down
elif [[ "$3" == 'stop' ]]; then
docker-compose stop
else
docker-compose up -d
fi
elif [[ "$2" == 'hosts' ]]; then
a=$(run frappe "ls sites/*/site_config.json | grep -o '/.\+/'") \
a="${a//$'\n'/ }"
a=$(echo "$a" | tr -d / )
result="127.0.0.1 ${a}"
run root "echo ${result} | tee --append /etc/hosts"
fi
elif [[ "$1" == '-c' ]]; then
shift
user=$1
shift
run "$user" "$@"
elif [[ "$1" == '-h' ]]; then
echo "$0 [-h] | [ -c frappe | root <command to run> ] [ <command to send to bench> ]"
echo ""
echo "$0 extends the Frappe Bench tool, and is used like it. However, it extends the tool in a few places."
echo "Usage:"
echo " $0"
echo " Launches you into an interactive shell in the container as user frappe"
echo " $0 setup docker [ stop | down ]"
echo " Starts and builds the docker containers using \"docker-compose up -d\""
echo " $0 setup hosts"
echo " Adds all sites to the containers hosts file"
echo " $0 -c frappe | root <command to run>"
echo " Runs a command in the container, as the selected user"
echo " $0 -h"
echo " Shows this help message"
echo " $0 <command to send to bench>"
echo " Runs a command in bench, i.e. $0 new-site site1.local = bench new-site site1.local"
else
IFS=" "
run frappe "bench $*"
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liuyibin23/frappe_docker.git
git@gitee.com:liuyibin23/frappe_docker.git
liuyibin23
frappe_docker
frappe_docker
master

搜索帮助