From e236190aaa99adcf57e78458a09313310575dc16 Mon Sep 17 00:00:00 2001
From: parsa aghaei
Date: Sat, 11 Jul 2026 20:56:16 +0330
Subject: [PATCH] nodemodules added to repo
---
Dockerfile | 7 ++-----
backend/Dockerfile | 25 +++++++++++--------------
2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 20163ab..76ac129 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,8 +3,7 @@ FROM docker.arvancloud.ir/library/node:22-alpine AS app-builder
RUN sed -i 's/dl-cdn.alpinelinux.org/mirror.arvancloud.ir/g' /etc/apk/repositories && \
apk add --no-cache openssl
WORKDIR /app
-COPY frontend/application/package*.json ./
-RUN npm config set registry https://registry.npmmirror.com && npm install
+# Copy everything including node_modules
COPY frontend/application ./
RUN npm run build
@@ -13,14 +12,12 @@ FROM docker.arvancloud.ir/library/node:22-alpine AS admin-builder
RUN sed -i 's/dl-cdn.alpinelinux.org/mirror.arvancloud.ir/g' /etc/apk/repositories && \
apk add --no-cache openssl
WORKDIR /app
-COPY frontend/admin-panel/package*.json ./
-RUN npm config set registry https://registry.npmmirror.com && npm install
+# Copy everything including node_modules
COPY frontend/admin-panel ./
RUN npm run build
# Production stage
FROM docker.arvancloud.ir/nginxinc/nginx-unprivileged:alpine
-# No need for apk add here unless needed by nginx, but let's keep it clean
WORKDIR /usr/share/nginx/html
COPY --from=app-builder /app/.next ./.next
COPY --from=app-builder /app/public ./public
diff --git a/backend/Dockerfile b/backend/Dockerfile
index f48ad94..ff0057d 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -1,36 +1,33 @@
-# Build stage for Backend
FROM docker.arvancloud.ir/library/node:22-alpine AS builder
-# Use ArvanCloud Alpine mirror to fix TLS/timeout issues
RUN sed -i 's/dl-cdn.alpinelinux.org/mirror.arvancloud.ir/g' /etc/apk/repositories && \
apk add --no-cache openssl
WORKDIR /app
-COPY package*.json ./
-# Using mirror for npm as well
-RUN npm config set registry https://registry.npmmirror.com
-RUN npm ci
-
+# Copy all files including node_modules
COPY . .
+
+# Generate prisma client using the existing node_modules
RUN npx prisma generate
RUN npm run build
-# Production stage
+# Production image
FROM docker.arvancloud.ir/library/node:22-alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirror.arvancloud.ir/g' /etc/apk/repositories && \
apk add --no-cache openssl
WORKDIR /app
-COPY package*.json ./
-RUN npm config set registry https://registry.npmmirror.com
-RUN npm ci --only=production
-COPY --from=builder /app/dist ./dist
-COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
-COPY --from=builder /app/node_modules/@prisma/client ./node_modules/@prisma/client
+# Copy everything needed for production
+COPY package*.json ./
+COPY node_modules ./node_modules
+COPY dist ./dist
EXPOSE 3000
+
USER node
+
+# Start the application
CMD ["node", "dist/main"]