Fix npm registry ARG so builds use npmmirror by default

ARG after FROM was empty without an explicit default, so npm ci hit the slow/blocked official registry.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-05 20:49:49 +03:30
co-authored by Cursor
parent 9a9566dd50
commit 5ed1b83457
2 changed files with 11 additions and 8 deletions
+9 -8
View File
@@ -1,17 +1,19 @@
# syntax=docker/dockerfile:1
# میرور npm برای سرورهای ایران (قابل تغییر با --build-arg)
# میرور npm برای سرورهای ایران
ARG NPM_REGISTRY=https://registry.npmmirror.com
FROM node:22-alpine AS builder
ARG NPM_REGISTRY
# حتماً دوباره با default تعریف شود؛ وگرنه بعد از FROM خالی می‌ماند
ARG NPM_REGISTRY=https://registry.npmmirror.com
WORKDIR /app
# openssl از قبل داخل node:alpine هست؛ apk را حذف کردیم چون CDN آلپاین روی خیلی از سرورها TLS error می‌دهد
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
COPY package.json package-lock.json ./
RUN npm ci
RUN npm config set fetch-retries 5 \
&& npm config set fetch-retry-mintimeout 20000 \
&& npm config set fetch-retry-maxtimeout 120000 \
&& npm ci --no-audit --no-fund \
&& echo "npm ci done via $NPM_CONFIG_REGISTRY"
COPY prisma ./prisma
COPY prisma.config.ts ./
@@ -21,9 +23,8 @@ COPY src ./src
RUN npx prisma generate \
&& npm run build \
&& npm prune --omit=dev \
&& npm install prisma ts-node typescript --no-save --registry=${NPM_REGISTRY}
&& npm install prisma ts-node typescript --no-save --no-audit --no-fund --registry=${NPM_REGISTRY}
# Production image — بدون apk / بدون npm دوباره
FROM node:22-alpine AS runner
WORKDIR /app
+2
View File
@@ -21,6 +21,8 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
NPM_REGISTRY: ${NPM_REGISTRY:-https://registry.npmmirror.com}
container_name: fabric_trade_api
restart: unless-stopped
depends_on: