Files
dysync/.gitea/workflows/deploy.yml
T
yuming 93945ce25d ci: 构建镜像加 --no-cache 绕开 buildx 旧 layer 缓存
上次推的 d0ac3d9 已经把 statics.vue 改成干净版(1362 行,
grep 全项目找不到 handleCancelDeleteAuthor 等函数),但 CI 依然
报同样 5 处孤儿引用错误。唯一解释是 docker buildx 复用了几天前
的 COPY app/ layer(那个 layer 里 statics.vue 还是老的 1591 行)。

修改:docker build 加 --no-cache --pull,强制这次全新构建。
下次可以移除 --no-cache(旧缓存已被覆盖)。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-04 15:12:06 +08:00

58 lines
2.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: 部署到群晖
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 安装 Docker CLI
run: |
if command -v docker >/dev/null 2>&1; then
echo "Docker 已预装:$(docker --version)"
exit 0
fi
echo "Docker 未预装,换 apt 源到阿里云再安装(gitea act_runner 实际是 Debian 11)"
# Debian 源(当前 runner 实际用的)
sed -i 's|deb.debian.org|mirrors.aliyun.com|g;s|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list 2>/dev/null || true
sed -i 's|deb.debian.org|mirrors.aliyun.com|g;s|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/*.list 2>/dev/null || true
# Ubuntu 源兼容(万一以后 runner 镜像换成 Ubuntu)
sed -i 's|archive.ubuntu.com|mirrors.aliyun.com|g;s|security.ubuntu.com|mirrors.aliyun.com|g' /etc/apt/sources.list 2>/dev/null || true
sed -i 's|archive.ubuntu.com|mirrors.aliyun.com|g;s|security.ubuntu.com|mirrors.aliyun.com|g' /etc/apt/sources.list.d/*.sources 2>/dev/null || true
timeout 90 apt-get update -qq || { echo "apt-get update 超时/失败"; exit 1; }
timeout 240 apt-get install -y -qq docker.io || { echo "docker.io 安装超时/失败"; exit 1; }
docker --version
- name: 拉取代码
uses: actions/checkout@v4
- name: 构建镜像
# --no-cache:绕开 buildx 旧 layer 缓存(曾出现 CI 用几天前缓存的 statics.vue 导致 vue-tsc 报孤儿引用错误)
run: docker build --no-cache --pull -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 查看"