app #2 piano-sheet: 钢琴谱管理 / 阅读,piano.famzheng.me
后端 axum + sqlite,图片直接 BLOB 存进 pages 表(单张 ≤ 10MB / 单 谱 ≤ 64 页),5 个 endpoint:multipart upload、列表、详情、单页图片 (带 immutable cache header)+ healthz。 前端 vue3 + pinia + vue-router,3 个视图:列表(卡片网格 + 首页缩 略)、上传(拖拽 + 顺序预览)、阅读(全屏,左右点按 / 键盘 / 拖 拽进度条翻页,2.5s 自动隐藏 chrome)。视图状态走 URL(reader 的 当前页是 ?page=N)。 部署:cube-piano-sheet ns + 10Gi PVC + traefik ingress + 一条 buffering middleware 把 body 上限抬到 700MB。镜像 < 20MB(scratch + musl 静态)。
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
name: deploy piano-sheet
|
||||
# piano.famzheng.me — 钢琴谱管理 / 阅读。host shell runner(fam 用户)。
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'apps/piano-sheet/**'
|
||||
- 'crates/cube-core/**'
|
||||
- 'Cargo.toml'
|
||||
- 'Cargo.lock'
|
||||
- '.gitea/workflows/deploy-piano-sheet.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
APP: piano-sheet
|
||||
IMAGE: registry.famzheng.me/mochi/piano-sheet
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Resolve image tag
|
||||
id: tag
|
||||
run: |
|
||||
echo "sha=$(git rev-parse --short=12 HEAD)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build rust (musl static)
|
||||
run: |
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
cargo build --release --target x86_64-unknown-linux-musl -p "$APP"
|
||||
|
||||
- name: Build frontend
|
||||
run: |
|
||||
cd "apps/$APP/frontend"
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
- name: Build & push image
|
||||
env:
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
echo "$REGISTRY_TOKEN" | docker login registry.famzheng.me -u mochi --password-stdin
|
||||
docker build -f "apps/$APP/Dockerfile" -t "$IMAGE:${{ steps.tag.outputs.sha }}" .
|
||||
docker push "$IMAGE:${{ steps.tag.outputs.sha }}"
|
||||
|
||||
- name: Roll out to k3s
|
||||
run: |
|
||||
kubectl -n "cube-$APP" set image "deploy/$APP" "$APP=$IMAGE:${{ steps.tag.outputs.sha }}"
|
||||
kubectl -n "cube-$APP" rollout status "deploy/$APP" --timeout=120s
|
||||
Reference in New Issue
Block a user