From 61a3d0ae4bb1d8ad31efb613afa1a44d51a02a04 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Fri, 6 Mar 2026 08:43:01 +0800 Subject: [PATCH] fix: sync dashboard compose files during CI deploy Ensure dashboard deploy workflows copy tracked compose files into /nas-dashboard before docker compose up, so new SSH host mounts/envs (like Mac terminal) actually reach runtime. Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitea/workflows/deploy-dev.yml | 32 ++++++++++++++++++++++++++++++++ .gitea/workflows/deploy.yml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/.gitea/workflows/deploy-dev.yml b/.gitea/workflows/deploy-dev.yml index 50ed66f..29b8e0b 100644 --- a/.gitea/workflows/deploy-dev.yml +++ b/.gitea/workflows/deploy-dev.yml @@ -25,7 +25,39 @@ jobs: git remote add origin http://gitea:3000/jimmy/nas-tools.git git fetch --depth 1 origin "$GITHUB_SHA" git checkout --detach FETCH_HEAD + - name: Warm mirror cache for base images + run: | + set -u + mirror_host="127.0.0.1:5501" + + if command -v curl >/dev/null 2>&1; then + if curl -fsS "http://${mirror_host}/v2/" >/dev/null; then + echo "Registry mirror is healthy at ${mirror_host}" + else + echo "Warning: registry mirror health check failed at ${mirror_host}; continuing with normal pull path" + fi + else + echo "Warning: curl is unavailable; skipping explicit mirror health check" + fi + + prewarm_base_image() { + image_ref="$1" + mirror_ref="${mirror_host}/library/${image_ref}" + echo "Attempting mirror pre-pull: ${mirror_ref}" + if docker pull "${mirror_ref}"; then + docker tag "${mirror_ref}" "${image_ref}" + echo "Mirror pre-pull succeeded for ${image_ref}" + else + echo "Warning: mirror pre-pull failed for ${image_ref}; continuing with normal pull during build" + fi + } + + prewarm_base_image "node:20-alpine" + prewarm_base_image "python:3.12-slim" + - name: Build dev image run: DOCKER_BUILDKIT=0 docker build --cache-from nas-dashboard-dev:latest -t nas-dashboard-dev:latest dashboard/ + - name: Sync runtime compose file + run: cp dashboard/docker-compose.dev.yml /nas-dashboard/docker-compose.dev.yml - name: Deploy dev run: docker compose -f /nas-dashboard/docker-compose.dev.yml up -d --pull never diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 4f5906d..4c8616e 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -25,7 +25,39 @@ jobs: git remote add origin http://gitea:3000/jimmy/nas-tools.git git fetch --depth 1 origin "$GITHUB_SHA" git checkout --detach FETCH_HEAD + - name: Warm mirror cache for base images + run: | + set -u + mirror_host="127.0.0.1:5501" + + if command -v curl >/dev/null 2>&1; then + if curl -fsS "http://${mirror_host}/v2/" >/dev/null; then + echo "Registry mirror is healthy at ${mirror_host}" + else + echo "Warning: registry mirror health check failed at ${mirror_host}; continuing with normal pull path" + fi + else + echo "Warning: curl is unavailable; skipping explicit mirror health check" + fi + + prewarm_base_image() { + image_ref="$1" + mirror_ref="${mirror_host}/library/${image_ref}" + echo "Attempting mirror pre-pull: ${mirror_ref}" + if docker pull "${mirror_ref}"; then + docker tag "${mirror_ref}" "${image_ref}" + echo "Mirror pre-pull succeeded for ${image_ref}" + else + echo "Warning: mirror pre-pull failed for ${image_ref}; continuing with normal pull during build" + fi + } + + prewarm_base_image "node:20-alpine" + prewarm_base_image "python:3.12-slim" + - name: Build run: DOCKER_BUILDKIT=0 docker build -t nas-dashboard:latest dashboard/ + - name: Sync runtime compose file + run: cp dashboard/docker-compose.yml /nas-dashboard/docker-compose.yml - name: Deploy run: docker compose -f /nas-dashboard/docker-compose.yml up -d --pull never