improvement: DockerFiles updated to avoid some deployment issues.

This commit is contained in:
2026-07-20 21:11:08 +03:30
parent db515f9630
commit 245a238d1a
2 changed files with 19 additions and 3 deletions

View File

@@ -9,13 +9,22 @@ COPY package*.json ./
COPY .npmrc ./ COPY .npmrc ./
COPY prisma ./prisma/ 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 . . COPY . .
RUN npm run prisma:generate RUN npm run prisma:generate
RUN npm run build RUN npm run build
RUN npm prune --production RUN npm prune --omit=dev
# ============================================ # ============================================

View File

@@ -4,7 +4,14 @@ FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
COPY package*.json ./ 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 . . COPY . .