chore: Storage 初版 — 家庭共享物品管理 (React+TS+Vite+Express+DuckDB)
Build and Deploy / build-image (push) Failing after 2m26s
Build and Deploy / build-image (push) Failing after 2m26s
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
name: Build and Deploy
|
||||
|
||||
# 每次主分支提交: 构建前端 + Docker 镜像 → 在 runner (baihu) 上重建容器自动部署
|
||||
# 端口 3003 (与 Wardrobe :3002 / iboard :3001 同机共存, 按部署环境分配, 见 部署环境.md)
|
||||
# 数据持久化: 具名卷 storage-data 挂载 /app/data (DuckDB + 图片), 重建容器不丢数据
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build-image:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: https://gitea.com/actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install deps
|
||||
run: npm ci --no-audit --no-fund
|
||||
|
||||
- name: Typecheck & build
|
||||
run: |
|
||||
npm run check
|
||||
npm run build
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build -t storage:latest .
|
||||
|
||||
- name: Remove old container
|
||||
run: docker rm -vf storage || true
|
||||
|
||||
- name: Run container
|
||||
# 一键镜像: 静态前端 + API + 图片; 端口 3003
|
||||
run: docker run -d --name storage -p 3003:3003 \
|
||||
-v storage-data:/app/data \
|
||||
storage:latest
|
||||
|
||||
- name: Verify health
|
||||
run: |
|
||||
for i in $(seq 1 20); do
|
||||
if curl -sf http://127.0.0.1:3003/healthz >/dev/null 2>&1; then
|
||||
echo "storage healthy after ${i}s"
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "ERROR: storage did not become healthy" >&2
|
||||
docker logs storage --tail 50 2>&1
|
||||
exit 1
|
||||
Reference in New Issue
Block a user