mirror of
https://github.com/yibaiba/hideck.git
synced 2026-12-06 08:02:21 +00:00
feat(docker): add pull deployment script
This commit is contained in:
1 parent
71008b0a08
commit
e2284854ed
3 files changed
+58
-5
No files matched your search
+13
-1
@@ -7,7 +7,19 @@
|
||||
- `linux/amd64`
|
||||
- `linux/arm64`
|
||||
|
||||
## 快速启动
|
||||
## 快速启动(推荐)
|
||||
|
||||
仓库内置部署脚本,会初始化缺失的配置和持久化目录,再拉取并启动最新镜像:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/yibaiba/hideck.git
|
||||
cd hideck
|
||||
./deploy.sh
|
||||
```
|
||||
|
||||
脚本不会覆盖已有的 `config/config.yaml`。
|
||||
|
||||
## 手工部署
|
||||
|
||||
```bash
|
||||
mkdir -p hideck/{config,data,logs}
|
||||
|
||||
@@ -34,12 +34,11 @@ HiDeck 是面向高通 4G/LTE/5G 模组的综合管理平台,将设备热插
|
||||
```bash
|
||||
git clone https://github.com/yibaiba/hideck.git
|
||||
cd hideck
|
||||
|
||||
cp config/config.example.yaml config/config.yaml
|
||||
mkdir -p data logs
|
||||
docker compose up -d
|
||||
./deploy.sh
|
||||
```
|
||||
|
||||
`deploy.sh` 会在首次运行时从示例生成 `config/config.yaml`,创建持久化目录,拉取 `latest` 并启动容器。已有配置不会被覆盖。
|
||||
|
||||
浏览器打开:
|
||||
|
||||
```text
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
PROJECT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
CONFIG_DIR="$PROJECT_DIR/config"
|
||||
CONFIG_FILE="$CONFIG_DIR/config.yaml"
|
||||
CONFIG_EXAMPLE="$CONFIG_DIR/config.example.yaml"
|
||||
|
||||
initialize_directories() {
|
||||
mkdir -p "$CONFIG_DIR" "$PROJECT_DIR/data" "$PROJECT_DIR/logs"
|
||||
}
|
||||
|
||||
initialize_config() {
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
printf '保留现有配置:%s\n' "$CONFIG_FILE"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG_EXAMPLE" ]; then
|
||||
printf '缺少配置模板:%s\n' "$CONFIG_EXAMPLE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp "$CONFIG_EXAMPLE" "$CONFIG_FILE"
|
||||
chmod 600 "$CONFIG_FILE"
|
||||
printf '已创建配置:%s\n' "$CONFIG_FILE"
|
||||
}
|
||||
|
||||
run_compose() {
|
||||
docker compose -f "$PROJECT_DIR/docker-compose.yml" --project-directory "$PROJECT_DIR" "$@"
|
||||
}
|
||||
|
||||
deploy() {
|
||||
run_compose pull
|
||||
run_compose up -d --remove-orphans
|
||||
run_compose ps
|
||||
}
|
||||
|
||||
initialize_directories
|
||||
initialize_config
|
||||
deploy
|
||||
Reference in new issue
Block a user