Compare commits
3 Commits
aae8ca3b87
..
v0.9.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 94747c75dd | |||
| 7978a7e1e1 | |||
| e9e2034d30 |
@@ -0,0 +1,43 @@
|
|||||||
|
name: docker-image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY_HOST: code.wanderingbadger.dev
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
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: ${{ env.REGISTRY_HOST }}
|
||||||
|
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: |
|
||||||
|
${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
|
||||||
|
${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:latest
|
||||||
@@ -229,6 +229,38 @@ 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/<owner>/<repo>`
|
||||||
|
|
||||||
|
当前 workflow 不再把 image name 硬编码到特定 user package 路径,而是直接使用当前仓库标识生成镜像路径:
|
||||||
|
|
||||||
|
- `code.wanderingbadger.dev/${github.repository}:${tag}`
|
||||||
|
|
||||||
|
在 Gitea 这里,package 更贴近 repo 归属的语义,主要体现在镜像命名路径本身,而不是额外的“绑定”动作。也就是说,当前发布方式是按仓库路径约定来对齐 repo/package 语义。
|
||||||
|
|
||||||
|
这个 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 +310,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)
|
|
||||||
|
|||||||
@@ -10,3 +10,20 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
- ./.env:/app/.env:ro
|
- ./.env:/app/.env:ro
|
||||||
|
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana:latest
|
||||||
|
container_name: home-automation-grafana
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "10.238.75.70:8882:3000"
|
||||||
|
environment:
|
||||||
|
GF_PLUGINS_PREINSTALL: frser-sqlite-datasource
|
||||||
|
volumes:
|
||||||
|
- ./data:/data/home-automation:ro
|
||||||
|
- homeautomation_grafana_storage:/var/lib/grafana
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
homeautomation_grafana_storage:
|
||||||
|
|||||||
Reference in New Issue
Block a user