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