Compare commits

...

28 Commits

Author SHA1 Message Date
f4664808f7 Retry 1229
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 21s
2025-06-17 12:29:37 -03:00
e03359ffbd Retry 1225
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 19s
2025-06-17 12:26:00 -03:00
34dea2b413 Retry 1222
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 25s
2025-06-17 12:22:30 -03:00
935aac16e1 Retry 1217
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 19s
2025-06-17 12:17:57 -03:00
93f36c7dee Retry 1156
Some checks failed
Build and Deploy / build-and-save (push) Successful in 18s
Build and Deploy / deploy (push) Failing after 13s
2025-06-17 11:56:35 -03:00
85b9dbadde Retry 1151
Some checks failed
Build and Deploy / build-and-save (push) Successful in 20s
Build and Deploy / deploy (push) Failing after 14s
2025-06-17 11:51:30 -03:00
b3ed6f6c21 Retry 1149
Some checks failed
Build and Deploy / build-and-push (push) Successful in 17s
Build and Deploy / deploy (push) Failing after 11s
2025-06-17 11:49:04 -03:00
45c8742906 Retry 1141
Some checks failed
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 9s
2025-06-17 11:41:31 -03:00
3ef3bc8949 Retry 1138
Some checks failed
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 9s
2025-06-17 11:38:10 -03:00
bf42b30cb0 Retry 1133
Some checks failed
Build and Deploy / build-and-push (push) Successful in 11s
Build and Deploy / deploy (push) Failing after 8s
2025-06-17 11:33:19 -03:00
0ab95b2ead Retry 1131
Some checks failed
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 11s
2025-06-17 11:31:45 -03:00
e5288b4723 Retry 1128
Some checks failed
Build and Deploy / build-and-push (push) Successful in 16s
Build and Deploy / deploy (push) Failing after 9s
2025-06-17 11:28:37 -03:00
a5451a193e Retry 1115
Some checks failed
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 40s
2025-06-17 11:15:34 -03:00
9356f94047 Retry 1111
Some checks failed
Build and Deploy / build-and-push (push) Successful in 11s
Build and Deploy / deploy (push) Failing after 9s
2025-06-17 11:11:57 -03:00
322d3f77de Retry 1106
Some checks failed
Build and Deploy / build-and-push (push) Successful in 11s
Build and Deploy / deploy (push) Failing after 55s
2025-06-17 11:06:53 -03:00
ae6a91b9a7 Retry 1101
All checks were successful
Build and Deploy / build-and-push (push) Successful in 11s
Build and Deploy / deploy (push) Successful in 11s
2025-06-17 11:01:34 -03:00
4acf92838b Retry 1051
Some checks failed
Build and Deploy / build-and-push (push) Successful in 11s
Build and Deploy / deploy (push) Failing after 36s
2025-06-17 10:51:32 -03:00
c0c151ff8e Retry 1040
Some checks failed
Build and Deploy / build-and-push (push) Successful in 11s
Build and Deploy / deploy (push) Failing after 44s
2025-06-17 10:41:00 -03:00
761b10a63e Retry 1035
Some checks failed
Build and Deploy / build-and-push (push) Successful in 11s
Build and Deploy / deploy (push) Failing after 41s
2025-06-17 10:35:12 -03:00
3d6cad5f5a Retry 1033
Some checks failed
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 8s
2025-06-17 10:33:13 -03:00
d94fd9d8cd Retry 1027
Some checks failed
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 45s
2025-06-17 10:27:58 -03:00
b78475e8ed Cambios 1026
Some checks failed
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 9s
2025-06-17 10:26:19 -03:00
226b1667c2 Retry 1016
Some checks failed
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 55s
2025-06-17 10:16:58 -03:00
1976526c7f Retry 1014
Some checks failed
Build and Deploy / build-and-push (push) Successful in 12s
Build and Deploy / deploy (push) Failing after 6s
2025-06-17 10:14:28 -03:00
f082b2dd01 Fix deploy
All checks were successful
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Successful in 12s
2025-06-17 10:03:56 -03:00
4e445107f2 1001
Some checks failed
Build and Deploy / build-and-push (push) Successful in 10s
Build and Deploy / deploy (push) Failing after 8s
2025-06-17 10:01:50 -03:00
631a094c8c Fix Kaniko
Some checks failed
Build and Deploy / build-and-push (push) Failing after 11s
Build and Deploy / deploy (push) Has been skipped
2025-06-17 10:00:18 -03:00
98c2593bf0 Retry Kaniko
Some checks failed
Build and Deploy / build-and-push (push) Failing after 7s
Build and Deploy / deploy (push) Has been skipped
2025-06-17 09:58:48 -03:00

View File

@@ -13,64 +13,81 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
# --- Instalar Docker en el Entorno del Job ---
- name: Install Docker CLI
- name: Build Backend Image and Extract
run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce-cli
echo "Building backend image..."
# 1. Ejecutamos Kaniko y le damos un nombre, SIN --rm
docker run --name kaniko-backend \
-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=/kaniko/backend.tar # Guardamos en una ruta interna de Kaniko
- name: Login to Gitea Container Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.ACTIONS_PAT }}
echo "Extracting backend image..."
# 2. Copiamos el archivo desde el contenedor de Kaniko al workspace del job
docker cp kaniko-backend:/kaniko/backend.tar ${{ gitea.workspace }}/backend.tar
echo "Cleaning up backend builder..."
# 3. Eliminamos el contenedor de Kaniko
docker rm kaniko-backend
- name: Build and Push Backend Image
uses: docker/build-push-action@v4
with:
context: .
file: Backend/GestionIntegral.Api/Dockerfile
push: true
tags: ${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:latest,${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:${{ gitea.sha_short }}
- name: Build and Push Frontend Image
uses: docker/build-push-action@v4
with:
context: .
file: Frontend/Dockerfile
push: true
tags: ${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:latest,${{ secrets.REGISTRY_URL }}/${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:${{ gitea.sha_short }}
- name: Deploy to Production
- name: Build Frontend Image and Extract
run: |
echo "Deploying to production server..."
# Ya no necesitamos instalar openssh-client, porque la imagen base ya lo tiene.
echo "Building frontend image..."
docker run --name kaniko-frontend \
-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=/kaniko/frontend.tar
echo "Extracting frontend image..."
docker cp kaniko-frontend:/kaniko/frontend.tar ${{ gitea.workspace }}/frontend.tar
echo "Cleaning up frontend builder..."
docker rm kaniko-frontend
- name: Verify Artifacts
run: |
echo "--- Verifying contents of workspace ---"
ls -l ${{ gitea.workspace }}
- name: Deploy to Production via SCP and SSH
run: |
set -e
echo "Preparing SSH client..."
apt-get update && apt-get install -y openssh-client
mkdir -p ~/.ssh
echo "${{ secrets.PROD_SERVER_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
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/
echo "Connecting to host to load images and deploy..."
ssh ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_HOST }} << 'EOF'
set -e
echo "--- CONECTADO AL SERVIDOR DE PRODUCCIÓN ---"
cd /opt/gestion-integral
echo "Loading images into Docker..."
docker load < backend.tar
docker load < frontend.tar
echo "Starting application stack..."
export DB_SA_PASSWORD="${{ secrets.DB_SA_PASSWORD_SECRET }}"
export JWT_KEY="${{ secrets.JWT_KEY_SECRET }}"
docker login ${{ secrets.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.ACTIONS_PAT }}
docker compose pull
docker compose up -d
echo "Cleaning up tar files and old images..."
rm backend.tar frontend.tar
docker image prune -af
echo "--- DESPLIEGUE COMPLETADO ---"
echo "--- ¡¡DESPLIEGUE COMPLETADO Y VERIFICADO!! ---"
EOF