push main 触发:docker build Dockerfile.prod → 停旧启新容器 端口 10101:10101,数据卷按 volume1(db/logs)+ volume2(视频)分卷 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
name: 部署到群晖
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 安装 Docker CLI
|
||||
run: |
|
||||
# 替换 Debian 源为清华镜像,避免国内连 deb.debian.org 超时
|
||||
sed -i 's|deb.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null || true
|
||||
sed -i 's|security.debian.org|mirrors.tuna.tsinghua.edu.cn/debian-security|g' /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null || true
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq docker.io
|
||||
|
||||
- name: 拉取代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 构建镜像
|
||||
run: docker build -f Dockerfile.prod -t dysync:latest .
|
||||
|
||||
- name: 停止旧容器
|
||||
run: |
|
||||
docker stop dysync 2>/dev/null || true
|
||||
docker rm dysync 2>/dev/null || true
|
||||
|
||||
- name: 启动新容器
|
||||
run: |
|
||||
docker run -d \
|
||||
--name dysync \
|
||||
--restart unless-stopped \
|
||||
-p 10101:10101 \
|
||||
-e TZ=Asia/Shanghai \
|
||||
-e ASPNETCORE_ENVIRONMENT=Production \
|
||||
-v /volume1/docker/apps/dysync/db:/app/db \
|
||||
-v /volume1/docker/apps/dysync/logs:/app/logs \
|
||||
-v /volume2/save/dysync/collect:/app/collect \
|
||||
-v /volume2/save/dysync/favorite:/app/favorite \
|
||||
-v /volume2/save/dysync/uper:/app/uper \
|
||||
dysync:latest
|
||||
|
||||
- name: 部署完成提示
|
||||
run: |
|
||||
echo "✅ 部署完成,浏览器访问 http://192.168.1.66:10101 查看"
|
||||
Reference in New Issue
Block a user