Reversión de deploy
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 3m8s

This commit is contained in:
2025-06-25 23:00:56 -03:00
parent 03cda5cdbe
commit d60ec7ffd7

View File

@@ -37,56 +37,32 @@ jobs:
cd "$TEMP_DIR" cd "$TEMP_DIR"
git checkout "${{ gitea.sha }}" git checkout "${{ gitea.sha }}"
# 2. Directorios de caché # 2. Construcción paralela con Docker nativo (más rápido y fiable)
KANIKO_CACHE_BACKEND="/kaniko_cache/backend"
KANIKO_CACHE_FRONTEND="/kaniko_cache/frontend"
mkdir -p "$KANIKO_CACHE_BACKEND" "$KANIKO_CACHE_FRONTEND"
chmod 777 "$KANIKO_CACHE_BACKEND" "$KANIKO_CACHE_FRONTEND"
# 3. Construcción paralela con Kaniko (con cache-repo local)
build_image() { build_image() {
local context=$1 local dockerfile=$1
local dockerfile=$2 local image_name=$2
local cache_dir=$3 local context=$3
local image_name=$4
local tar_path=$5
docker run --rm \ echo "Construyendo $image_name..."
-v "$TEMP_DIR":/workspace \ docker build \
-v "$cache_dir":/cache \ -t "$image_name" \
gcr.io/kaniko-project/executor:v1.9.0 \ -f "$dockerfile" \
--context="/workspace/$context" \ "$context"
--dockerfile="/workspace/$dockerfile" \
--cache=true \
--cache-dir=/cache \
--cache-repo=localhost:5000/cache \
--no-push \
--destination="$image_name" \
--tarPath="/workspace/$tar_path"
} }
echo "Construyendo imágenes en paralelo..." echo "Construyendo imágenes en paralelo..."
(build_image "." "Backend/GestionIntegral.Api/Dockerfile" "$KANIKO_CACHE_BACKEND" "gestionintegralweb-backend:latest" "backend.tar") & (build_image "Backend/GestionIntegral.Api/Dockerfile" "dmolinari/gestionintegralweb-backend:latest" ".") &
(build_image "." "Frontend/Dockerfile" "$KANIKO_CACHE_FRONTEND" "gestionintegralweb-frontend:latest" "frontend.tar") & (build_image "Frontend/Dockerfile" "dmolinari/gestionintegralweb-frontend:latest" ".") &
wait wait
# 4. Cargar imágenes y etiquetar # 3. Despliegue con Docker Compose
echo "Cargando y etiquetando imágenes..."
docker load -i "$TEMP_DIR/backend.tar"
docker load -i "$TEMP_DIR/frontend.tar"
# Etiquetar para docker-compose
docker tag gestionintegralweb-backend:latest dmolinari/gestionintegralweb-backend:latest
docker tag gestionintegralweb-frontend:latest dmolinari/gestionintegralweb-frontend:latest
# 5. Despliegue con Docker Compose
cd /opt/gestion-integral cd /opt/gestion-integral
export DB_SA_PASSWORD='${{ secrets.DB_SA_PASSWORD_SECRET }}' export DB_SA_PASSWORD='${{ secrets.DB_SA_PASSWORD_SECRET }}'
echo "Recreando servicios..." echo "Recreando servicios..."
docker compose up -d --force-recreate docker compose up -d --force-recreate
# 6. Limpieza # 4. Limpieza
echo "Realizando limpieza..." echo "Realizando limpieza..."
rm -rf "$TEMP_DIR" rm -rf "$TEMP_DIR"
docker image prune -af --filter "until=24h" docker image prune -af --filter "until=24h"