From 81799e714af0d44d2e7d1d26d857a5f3f8eebe5c Mon Sep 17 00:00:00 2001 From: wusumac <736139669@qq.com> Date: Wed, 12 Aug 2026 15:06:04 +0800 Subject: [PATCH] ops: cache NAS build dependencies Install npm dependencies and the amd64 Rust target before copying changing source files so routine builds can reuse those layers. Co-Authored-By: Codex --- Dockerfile.nas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile.nas b/Dockerfile.nas index 30bbd619..f993f3e6 100644 --- a/Dockerfile.nas +++ b/Dockerfile.nas @@ -9,11 +9,13 @@ RUN printf '#!/bin/sh\nexit 1\n' > /usr/local/bin/git \ && chmod +x /usr/local/bin/git WORKDIR /src +COPY package.json package-lock.json ./ +RUN npm ci + COPY . . ARG GITHUB_SHA=unknown -RUN npm ci \ - && npm run build +RUN npm run build FROM --platform=$BUILDPLATFORM rust:bookworm AS server-builder @@ -29,13 +31,13 @@ RUN sed -i \ gcc-x86-64-linux-gnu libc6-dev-amd64-cross \ && rm -rf /var/lib/apt/lists/* +RUN rustup target add x86_64-unknown-linux-gnu + WORKDIR /src COPY . . COPY --from=client-builder /src/client_bundle /src/client_bundle COPY --from=client-builder /src/version.json /src/version.json -RUN rustup target add x86_64-unknown-linux-gnu - ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc \ CC_x86_64_unknown_linux_gnu=x86_64-linux-gnu-gcc