fix: skip husky in production image
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
FROM node:24-bookworm-slim AS dependencies
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json .npmrc ./
|
||||
COPY scripts/prepare.mjs ./scripts/prepare.mjs
|
||||
RUN npm ci
|
||||
|
||||
FROM dependencies AS build
|
||||
@@ -13,6 +14,7 @@ RUN npm run build:app
|
||||
FROM node:24-bookworm-slim AS runtime-dependencies
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json .npmrc ./
|
||||
COPY scripts/prepare.mjs ./scripts/prepare.mjs
|
||||
RUN npm ci --omit=dev && npm cache clean --force
|
||||
|
||||
FROM node:24-bookworm-slim AS runtime
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@
|
||||
"env:encrypt:production": "dotenvx encrypt -f .env.production",
|
||||
"env:decrypt:production": "dotenvx decrypt -f .env.production",
|
||||
"env:stage": "node scripts/env-files.mjs stage",
|
||||
"prepare": "husky",
|
||||
"prepare": "node scripts/prepare.mjs",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"test": "vitest run",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
const omitted = new Set(
|
||||
String(process.env.npm_config_omit ?? '')
|
||||
.split(',')
|
||||
.map((value) => value.trim())
|
||||
.filter(Boolean),
|
||||
);
|
||||
|
||||
if (!omitted.has('dev') && process.env.NODE_ENV !== 'production') {
|
||||
const { default: husky } = await import('husky');
|
||||
husky();
|
||||
}
|
||||
Reference in New Issue
Block a user