2024-07-24 18:41:04 +08:00
|
|
|
|
#!/bin/bash
|
2024-11-18 23:12:52 +08:00
|
|
|
|
declare installation_directory=$1
|
|
|
|
|
declare web_service_port=$2
|
|
|
|
|
declare access_password
|
|
|
|
|
read -p "请输入思源访问密码(默认:Siyuan):" access_password
|
2024-07-24 18:41:04 +08:00
|
|
|
|
|
2024-11-18 23:12:52 +08:00
|
|
|
|
if [[ -z $access_password ]];then
|
|
|
|
|
access_password="Siyuan"
|
2024-07-24 18:41:04 +08:00
|
|
|
|
fi
|
|
|
|
|
|
2024-11-18 23:12:52 +08:00
|
|
|
|
chown -R 1000:1000 $installation_directory
|
|
|
|
|
cd $installation_directory
|
2024-07-24 18:41:04 +08:00
|
|
|
|
cat > "docker-compose.yml" << EOF
|
|
|
|
|
version: "3.9"
|
|
|
|
|
services:
|
|
|
|
|
siyuan:
|
|
|
|
|
image: b3log/siyuan
|
|
|
|
|
container_name: siyuan
|
|
|
|
|
user: '1000:1000'
|
|
|
|
|
restart: always
|
|
|
|
|
ports:
|
2024-11-18 23:12:52 +08:00
|
|
|
|
- $web_service_port:6806
|
2024-07-24 18:41:04 +08:00
|
|
|
|
volumes:
|
|
|
|
|
- ./:/siyuan/workspace
|
|
|
|
|
command:
|
|
|
|
|
- "--workspace=/siyuan/workspace/"
|
|
|
|
|
- "--lang=zh_CN"
|
2024-11-18 23:12:52 +08:00
|
|
|
|
- "--accessAuthCode=$access_password"
|
2024-07-24 18:41:04 +08:00
|
|
|
|
EOF
|
2024-11-18 23:12:52 +08:00
|
|
|
|
docker compose up -d || echo "安装失败" && exit
|
|
|
|
|
echo "访问密码:$access_password"
|