chore(docker): optimize builds and name images

- Add BuildKit cache mounts for NuGet and npm to persist package
  caches across builds
- Skip redundant restore on dotnet publish with --no-restore
- Add --prefer-offline to npm ci to prefer cached tarballs
- Tag images as randall/backend:latest and randall/frontend:latest
  via compose image: key

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Robert van Diest
2026-03-27 16:21:13 +01:00
parent cba080acfe
commit 4c71a1b4c8
3 changed files with 9 additions and 4 deletions

View File

@@ -4,7 +4,8 @@ WORKDIR /app
# Install dependencies — copy lockfiles first to cache the npm layer
COPY src/frontend/package.json src/frontend/package-lock.json ./
RUN npm ci
RUN --mount=type=cache,id=npm,target=/root/.npm \
npm ci --prefer-offline
# Copy source
COPY src/frontend/index.html ./