From e39c8a9491bddaaaecd9e15ae78ec0c67c6907fb Mon Sep 17 00:00:00 2001 From: dmolinari Date: Tue, 17 Jun 2025 12:26:00 -0300 Subject: [PATCH] Retry 1225 --- .gitea/workflows/deploy.yml | 46 ++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 806a784..5ba482e 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -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'