diff --git a/.gitea/workflows/deploy-dev.yml b/.gitea/workflows/deploy-dev.yml index 1324d23..07f8037 100644 --- a/.gitea/workflows/deploy-dev.yml +++ b/.gitea/workflows/deploy-dev.yml @@ -22,7 +22,7 @@ jobs: - name: Warm mirror cache for base images run: | set -u - mirror_host="127.0.0.1:5501" + mirror_host="100.78.131.124:5501" prewarm_base_image() { image_ref="$1" @@ -47,8 +47,14 @@ jobs: - name: Build dev image run: | + set -e 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 run: | mkdir -p /volume1/docker/nas-dashboard diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index ce0fcd7..40d58f8 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -54,7 +54,15 @@ jobs: prewarm_base_image "python:3.12-slim" - 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 run: cp dashboard/docker-compose.yml /nas-dashboard/docker-compose.yml - name: Deploy diff --git a/dashboard/.dockerignore b/dashboard/.dockerignore new file mode 100644 index 0000000..77f1f6a --- /dev/null +++ b/dashboard/.dockerignore @@ -0,0 +1,9 @@ +node_modules +.git +.gitignore +*.md +.env +.vscode +__pycache__ +*.pyc +.pytest_cache diff --git a/dashboard/Dockerfile b/dashboard/Dockerfile index 9ca993d..8780e9c 100644 --- a/dashboard/Dockerfile +++ b/dashboard/Dockerfile @@ -3,7 +3,8 @@ FROM node:20-alpine AS frontend WORKDIR /build COPY frontend/package.json frontend/package-lock.json* ./ 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 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 WORKDIR /app 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 --from=frontend /build/dist /app/static RUN chown -R app:app /app diff --git a/dashboard/frontend/src/routes/Files.svelte b/dashboard/frontend/src/routes/Files.svelte index fbeb3af..f3ddd21 100644 --- a/dashboard/frontend/src/routes/Files.svelte +++ b/dashboard/frontend/src/routes/Files.svelte @@ -135,7 +135,7 @@ {/if} {e.is_dir ? "—" : formatSize(e.size)} -
+
{#if !e.is_dir} {/if}