Files
ads-saas/Dockerfile
2026-03-30 17:04:27 +03:00

37 lines
935 B
Docker

# Step 1: Build Phase | مرحلة البناء
FROM node:20-alpine AS builder
WORKDIR /usr/src/app
# Copy package files | نسخ ملفات الحزم
COPY package*.json ./
# Install dependencies | تثبيت الاعتماديات
RUN npm install
# Copy source code | نسخ كود المصدر
COPY . .
# Build the app | بناء التطبيق
RUN npm run build
# Step 2: Production Phase | مرحلة الإنتاج
FROM node:20-alpine
WORKDIR /usr/src/app
# Copy package files | نسخ ملفات الحزم
COPY package*.json ./
# Install only production dependencies | تثبيت اعتماديات الإنتاج فقط
RUN npm install --only=production
# Copy built files from builder | نسخ الملفات المبنية من مرحلة البناء
COPY --from=builder /usr/src/app/dist ./dist
# Expose port | فتح المنفذ
EXPOSE 3001
# Command to run | أمر التشغيل
CMD ["node", "dist/main"]