This commit is contained in:
		| @@ -13,25 +13,38 @@ jobs: | ||||
|       - name: Checkout code | ||||
|         uses: actions/checkout@v3 | ||||
|  | ||||
|       - name: Build Backend Image and Save as Tar | ||||
|         run: | | ||||
|           docker run --rm -v ${{ gitea.workspace }}:/workspace gcr.io/kaniko-project/executor:v1.9.0 \ | ||||
|             --context=/workspace --dockerfile=/workspace/Backend/GestionIntegral.Api/Dockerfile \ | ||||
|             --no-push --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:latest \ | ||||
|             --tarPath=/workspace/backend.tar | ||||
|       # --- NUEVO PASO: PREPARAMOS UN DIRECTORIO DE SALIDA PERSISTENTE --- | ||||
|       - name: Create output directory | ||||
|         run: mkdir -p ${{ gitea.workspace }}/output | ||||
|  | ||||
|       - name: Build Frontend Image and Save as Tar | ||||
|       - name: Build Backend Image and Save to Output | ||||
|         run: | | ||||
|           docker run --rm -v ${{ gitea.workspace }}:/workspace gcr.io/kaniko-project/executor:v1.9.0 \ | ||||
|             --context=/workspace --dockerfile=/workspace/Frontend/Dockerfile \ | ||||
|             --no-push --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:latest \ | ||||
|             --tarPath=/workspace/frontend.tar | ||||
|           docker run --rm \ | ||||
|             -v ${{ gitea.workspace }}:/workspace \ | ||||
|             -v ${{ gitea.workspace }}/output:/output \ | ||||
|             gcr.io/kaniko-project/executor:v1.9.0 \ | ||||
|             --context=/workspace \ | ||||
|             --dockerfile=/workspace/Backend/GestionIntegral.Api/Dockerfile \ | ||||
|             --no-push \ | ||||
|             --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:latest \ | ||||
|             --tarPath=/output/backend.tar | ||||
|  | ||||
|       - name: Build Frontend Image and Save to Output | ||||
|         run: | | ||||
|           docker run --rm \ | ||||
|             -v ${{ gitea.workspace }}:/workspace \ | ||||
|             -v ${{ gitea.workspace }}/output:/output \ | ||||
|             gcr.io/kaniko-project/executor:v1.9.0 \ | ||||
|             --context=/workspace \ | ||||
|             --dockerfile=/workspace/Frontend/Dockerfile \ | ||||
|             --no-push \ | ||||
|             --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:latest \ | ||||
|             --tarPath=/output/frontend.tar | ||||
|        | ||||
|       # --- PASO DE DEPURACIÓN --- | ||||
|       - name: Debug - List Workspace Contents | ||||
|       - name: Verify Artifacts | ||||
|         run: | | ||||
|           echo "--- Listing contents of ${{ gitea.workspace }} ---" | ||||
|           ls -lR ${{ gitea.workspace }} | ||||
|           echo "--- Verifying contents of output directory ---" | ||||
|           ls -l ${{ gitea.workspace }}/output | ||||
|  | ||||
|       - name: Deploy to Production via SCP and SSH | ||||
|         run: | | ||||
| @@ -44,7 +57,8 @@ jobs: | ||||
|           ssh-keyscan -H ${{ secrets.PROD_SERVER_HOST }} >> ~/.ssh/known_hosts | ||||
|            | ||||
|           echo "Copying image files to production server..." | ||||
|           scp ${{ gitea.workspace }}/backend.tar ${{ gitea.workspace }}/frontend.tar ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_HOST }}:/opt/gestion-integral/ | ||||
|           # Ahora copiamos desde el subdirectorio 'output' | ||||
|           scp ${{ gitea.workspace }}/output/backend.tar ${{ gitea.workspace }}/output/frontend.tar ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_HOST }}:/opt/gestion-integral/ | ||||
|  | ||||
|           echo "Connecting to host to load images and deploy..." | ||||
|           ssh ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_HOST }} << 'EOF' | ||||
|   | ||||
		Reference in New Issue
	
	Block a user