# Step 1: Build Backend | مرحلة بناء الخلفية
FROM node:20-alpine AS builder
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

# Step 2: Production Phase | مرحلة الإنتاج
FROM node:20-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --only=production
COPY --from=builder /usr/src/app/dist ./dist

# Expose port | فتح المنفذ
EXPOSE 3660

# Command to run | أمر التشغيل
CMD ["node", "dist/main"]
