Przeglądaj źródła

modification dockerfile pour erreur build

DESKTOP-SMCIPAV\falko 6 miesięcy temu
rodzic
commit
741a597e1a
2 zmienionych plików z 31 dodań i 16 usunięć
  1. 9 10
      Jenkinsfile
  2. 22 6
      build/docker/angular-ssr/Dockerfile

+ 9 - 10
Jenkinsfile

@@ -53,16 +53,15 @@ pipeline {
 //             }
 //        }
          
-        stage('Build & Deploy') {
-            steps {
-                sh '''
-            docker-compose stop
-            docker-compose build --no-cache
-            docker-compose up -d --force-recreate
-
-                '''
-           }
-        }
+       stage('Build & Deploy') {
+  steps {
+    sh '''
+      docker-compose stop
+      docker-compose build --no-cache
+      docker-compose up -d --force-recreate --remove-orphans
+    '''
+  }
+}
 
         // ... (autres stages inchangés)
     }

+ 22 - 6
build/docker/angular-ssr/Dockerfile

@@ -1,23 +1,39 @@
+# === Étape 1 : Build SSR Angular (avec Node 14) ===
 FROM node:14-alpine AS builder
 
 WORKDIR /app
 
-COPY angular-client/package*.json ./
+# Installer les dépendances backend
+COPY package*.json ./
 RUN npm install
 
-COPY angular-client/ ./
-RUN npm run build:ssr
+# Copier le projet complet (backend + angular-client)
+COPY . .
 
+# Build Angular SSR dans angular-client
+WORKDIR /app/angular-client
+RUN npm install
+RUN npm run build:ssr
 
+# === Étape 2 : Runner final avec Node 14 ===
 FROM node:14-alpine AS runner
 
 WORKDIR /app
 ENV NODE_ENV=production
 ENV PORT=4000
 
-COPY --from=builder /app/dist ./dist
-COPY --from=builder /app/package.json ./package.json
+# Copier le serveur Express
+COPY --from=builder /app/index.js ./index.js
+COPY --from=builder /app/package*.json ./
+COPY --from=builder /app/routes ./routes
+COPY --from=builder /app/lib ./lib
+
+# Copier la build Angular SSR
+COPY --from=builder /app/angular-client/dist ./dist
+
+# Installer les dépendances nécessaires au runtime
+RUN npm install --omit=dev
 
 EXPOSE 4000
 
-CMD ["node", "dist/fatboar/server/main.js"]
+CMD ["node", "index.js"]