fix: add fallback registries and improve deployment reliability
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 3m2s
Run Tests / Backend Tests (push) Failing after 4m0s
Run Tests / Frontend Tests (push) Failing after 2m0s
Run Tests / Test Summary (push) Failing after 12s

- Add fallback to official npm/PyPI registries when Chinese mirrors fail
- Fix dev workflow mirror host (127.0.0.1 -> 100.78.131.124)
- Add error handling and diagnostics to build steps
- Fix iPhone UI: make download/delete buttons always visible on mobile
- Add .dockerignore to reduce build context size
This commit is contained in:
Gan, Jimmy
2026-04-10 01:00:49 +08:00
parent 1ff48ab86d
commit c180a68f36
5 changed files with 31 additions and 6 deletions
+8 -2
View File
@@ -22,7 +22,7 @@ jobs:
- name: Warm mirror cache for base images - name: Warm mirror cache for base images
run: | run: |
set -u set -u
mirror_host="127.0.0.1:5501" mirror_host="100.78.131.124:5501"
prewarm_base_image() { prewarm_base_image() {
image_ref="$1" image_ref="$1"
@@ -47,8 +47,14 @@ jobs:
- name: Build dev image - name: Build dev image
run: | run: |
set -e
export DOCKER_API_VERSION=1.43 export DOCKER_API_VERSION=1.43
DOCKER_BUILDKIT=0 docker build --cache-from nas-dashboard-dev:latest -t nas-dashboard-dev:latest dashboard/ if ! DOCKER_BUILDKIT=0 docker build --cache-from nas-dashboard-dev:latest -t nas-dashboard-dev:latest dashboard/; then
echo "Build failed. Checking for network issues..."
curl -I https://registry.npmmirror.com || echo "npmmirror unreachable"
curl -I https://pypi.tuna.tsinghua.edu.cn || echo "Tsinghua PyPI unreachable"
exit 1
fi
- name: Sync runtime compose file - name: Sync runtime compose file
run: | run: |
mkdir -p /volume1/docker/nas-dashboard mkdir -p /volume1/docker/nas-dashboard
+9 -1
View File
@@ -54,7 +54,15 @@ jobs:
prewarm_base_image "python:3.12-slim" prewarm_base_image "python:3.12-slim"
- name: Build - name: Build
run: DOCKER_BUILDKIT=0 docker build -t nas-dashboard:latest dashboard/ run: |
set -e
export DOCKER_API_VERSION=1.43
if ! DOCKER_BUILDKIT=0 docker build -t nas-dashboard:latest dashboard/; then
echo "Build failed. Checking for network issues..."
curl -I https://registry.npmmirror.com || echo "npmmirror unreachable"
curl -I https://pypi.tuna.tsinghua.edu.cn || echo "Tsinghua PyPI unreachable"
exit 1
fi
- name: Sync runtime compose file - name: Sync runtime compose file
run: cp dashboard/docker-compose.yml /nas-dashboard/docker-compose.yml run: cp dashboard/docker-compose.yml /nas-dashboard/docker-compose.yml
- name: Deploy - name: Deploy
+9
View File
@@ -0,0 +1,9 @@
node_modules
.git
.gitignore
*.md
.env
.vscode
__pycache__
*.pyc
.pytest_cache
+4 -2
View File
@@ -3,7 +3,8 @@ FROM node:20-alpine AS frontend
WORKDIR /build WORKDIR /build
COPY frontend/package.json frontend/package-lock.json* ./ COPY frontend/package.json frontend/package-lock.json* ./
COPY frontend/ ./ COPY frontend/ ./
RUN npm install --registry=https://registry.npmmirror.com && npm run build RUN npm install --registry=https://registry.npmmirror.com || npm install
RUN npm run build
# Stage 2: Python runtime # Stage 2: Python runtime
FROM python:3.12-slim FROM python:3.12-slim
@@ -11,7 +12,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends openssh-client
RUN adduser --disabled-password --no-create-home --gecos "" app RUN adduser --disabled-password --no-create-home --gecos "" app
WORKDIR /app WORKDIR /app
COPY backend/requirements.txt . COPY backend/requirements.txt .
RUN pip install --no-cache-dir --index-url https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt RUN pip install --no-cache-dir --index-url https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt || \
pip install --no-cache-dir -r requirements.txt
COPY backend/ ./ COPY backend/ ./
COPY --from=frontend /build/dist /app/static COPY --from=frontend /build/dist /app/static
RUN chown -R app:app /app RUN chown -R app:app /app
+1 -1
View File
@@ -135,7 +135,7 @@
</span> </span>
{/if} {/if}
<span class="text-xs text-surface-400 text-right">{e.is_dir ? "—" : formatSize(e.size)}</span> <span class="text-xs text-surface-400 text-right">{e.is_dir ? "—" : formatSize(e.size)}</span>
<div class="flex items-center justify-end gap-1 opacity-0 group-hover:opacity-100 transition-opacity"> <div class="flex items-center justify-end gap-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity">
{#if !e.is_dir} {#if !e.is_dir}
<button onclick={() => handleDownload(e.name)} class="text-[11px] text-primary-500 hover:text-primary-700 font-medium transition-colors">DL</button> <button onclick={() => handleDownload(e.name)} class="text-[11px] text-primary-500 hover:text-primary-700 font-medium transition-colors">DL</button>
{/if} {/if}