improvement: DockerFiles updated to avoid some deployment issues.
This commit is contained in:
@@ -9,13 +9,22 @@ COPY package*.json ./
|
||||
COPY .npmrc ./
|
||||
COPY prisma ./prisma/
|
||||
|
||||
RUN npm ci
|
||||
# npm ci can exit 0 on some Docker Desktop setups while leaving node_modules/.bin
|
||||
# empty ("Exit handler never called!") — then `prisma` / `nest` are "not found".
|
||||
RUN npm ci --no-audit --no-fund || true; \
|
||||
if [ ! -e node_modules/.bin/prisma ] || [ ! -e node_modules/.bin/nest ]; then \
|
||||
echo "Incomplete npm ci (missing .bin links) — falling back to npm install"; \
|
||||
rm -rf node_modules; \
|
||||
npm install --no-audit --no-fund; \
|
||||
fi; \
|
||||
test -e node_modules/.bin/prisma; \
|
||||
test -e node_modules/.bin/nest
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run prisma:generate
|
||||
RUN npm run build
|
||||
RUN npm prune --production
|
||||
RUN npm prune --omit=dev
|
||||
|
||||
|
||||
# ============================================
|
||||
|
||||
@@ -4,7 +4,14 @@ FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
# Same safeguard as backend: incomplete npm ci can leave node_modules/.bin empty.
|
||||
RUN npm ci --no-audit --no-fund || true; \
|
||||
if [ ! -e node_modules/.bin/next ]; then \
|
||||
echo "Incomplete npm ci (missing .bin links) — falling back to npm install"; \
|
||||
rm -rf node_modules; \
|
||||
npm install --no-audit --no-fund; \
|
||||
fi; \
|
||||
test -e node_modules/.bin/next
|
||||
|
||||
COPY . .
|
||||
|
||||
|
||||
Reference in New Issue
Block a user