From 61c16d8bacf5e12dbf1f8c7258d07bc920b42677 Mon Sep 17 00:00:00 2001 From: Jennie Robinson Faber Date: Sat, 4 Apr 2026 16:44:55 +0100 Subject: [PATCH] fix: multi-stage Dockerfile and guard husky for Docker builds Multi-stage build produces a smaller production image with only .output. Husky prepare script now tolerates missing .git (Docker, CI). --- Dockerfile | 12 ++++++++---- package.json | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 25498d8..54b1438 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,16 @@ -# Dockerfile -FROM node:20-alpine +# Build stage +FROM node:20-alpine AS builder WORKDIR /app COPY package*.json ./ -RUN npm ci - +RUN npm ci --ignore-scripts && npx nuxt prepare COPY . . RUN npm run build +# Production stage — only the self-contained .output is needed +FROM node:20-alpine +WORKDIR /app +COPY --from=builder /app/.output .output + EXPOSE 3000 CMD ["node", ".output/server/index.mjs"] diff --git a/package.json b/package.json index 1f86d57..921ffa5 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "test:visual:update": "npx playwright test e2e/visual/ --update-snapshots", "test:a11y": "npx playwright test e2e/a11y.spec.js", "test:all": "npm run test:run && npx playwright test", - "prepare": "husky" + "prepare": "husky || true" }, "dependencies": { "@cloudinary/vue": "^1.13.3",