Add release Docker image workflow
pytest / test (push) Successful in 42s
docker-image / build-and-push (push) Successful in 3m42s

This commit is contained in:
2026-04-20 22:18:54 +02:00
parent e9e2034d30
commit 7978a7e1e1
2 changed files with 65 additions and 16 deletions
+39
View File
@@ -0,0 +1,39 @@
name: docker-image
on:
push:
tags:
- "v*"
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: amd64,arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: code.wanderingbadger.dev
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push multi-arch image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
code.wanderingbadger.dev/tliu93/home-automation:${{ github.ref_name }}
code.wanderingbadger.dev/tliu93/home-automation:latest
+26 -16
View File
@@ -229,6 +229,32 @@ docker compose up -d --build
docker compose logs -f app docker compose logs -f app
``` ```
## Container Image CI
项目提供了一个 release image workflow
- workflow 文件:`.github/workflows/docker-image.yml`
- 触发条件:push 匹配 `v*` 的 tag,例如 `v1.0.0`
- registry`code.wanderingbadger.dev`
- image`code.wanderingbadger.dev/tliu93/home-automation`
这个 workflow 会构建并推送 multi-arch image
- `linux/amd64`
- `linux/arm64`
推送的 tag
- release tag 本身,例如 `v1.0.0`
- `latest`
workflow 依赖以下 secrets
- `REGISTRY_USERNAME`
- `REGISTRY_TOKEN`
CI 产出的 image 是给部署机直接 `docker pull` 使用的。部署机不需要 checkout 本仓库,也不需要本地执行 `docker build`
## 运行测试 ## 运行测试
```bash ```bash
@@ -278,19 +304,3 @@ SQLite 持久化目录:
- 本地 `./data` - 本地 `./data`
- 容器内 `/app/data` - 容器内 `/app/data`
## 后续迁移建议
后续可以在当前骨架上继续迁移这些模块:
- TickTick integration
- Home Assistant integration
- poo records
建议继续参考:
- [当前系统盘点](docs/current-system-inventory.md)
- [Python 重构方案](docs/python-rewrite-plan.md)
- [迁移风险清单](docs/migration-risks.md)
- [Location Recorder 接管说明](docs/location-recorder.md)
- [基础鉴权说明](docs/auth.md)