Retry 2309
Some checks failed
Optimized Build and Deploy / remote-build-and-deploy (push) Failing after 1m19s
Some checks failed
Optimized Build and Deploy / remote-build-and-deploy (push) Failing after 1m19s
This commit is contained in:
@@ -26,7 +26,7 @@ jobs:
|
||||
set -e
|
||||
echo "--- INICIO DEL DESPLIEGUE OPTIMIZADO ---"
|
||||
|
||||
# 1. Preparar entorno
|
||||
# 1. Preparar entorno (sin cambios)
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
REPO_OWNER="dmolinari"
|
||||
REPO_NAME="gestionintegralweb"
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
cd "$TEMP_DIR"
|
||||
git checkout "${{ gitea.sha }}"
|
||||
|
||||
# 2. Construcción paralela con Docker nativo (más rápido y fiable)
|
||||
# 2. Construcción paralela (sin cambios)
|
||||
build_image() {
|
||||
local dockerfile=$1
|
||||
local image_name=$2
|
||||
@@ -55,25 +55,31 @@ jobs:
|
||||
(build_image "Frontend/Dockerfile" "dmolinari/gestionintegralweb-frontend:latest" ".") &
|
||||
wait
|
||||
|
||||
# 3. Despliegue con Docker Compose
|
||||
cd /opt/gestion-integral
|
||||
export DB_SA_PASSWORD='${{ secrets.DB_SA_PASSWORD_SECRET }}'
|
||||
# Copiamos la versión actualizada del docker-compose.yml al directorio de despliegue.
|
||||
echo "Copiando el archivo docker-compose.yml actualizado..."
|
||||
cp "$TEMP_DIR/docker-compose.yml" /opt/gestion-integral/docker-compose.yml
|
||||
|
||||
# Pasa el secreto de Gitea a un Docker Secret
|
||||
# El comando "tr -d '\n'" elimina cualquier salto de línea final
|
||||
printf "%s" "${{ secrets.JWT_KEY }}" | tr -d '\n' | docker secret create jwt_secret_key - || docker secret inspect jwt_secret_key > /dev/null
|
||||
# (Opcional pero recomendado) Verificamos que el archivo se copió bien
|
||||
echo "--- Verificando contenido del docker-compose.yml que se usará ---"
|
||||
cat /opt/gestion-integral/docker-compose.yml | head -n 5
|
||||
echo "------------------------------------------------------------------"
|
||||
|
||||
# 3. Crear/Actualizar los Docker Secrets (sin cambios)
|
||||
# ... (tus comandos docker secret create) ...
|
||||
printf "%s" '${{ secrets.JWT_KEY }}' | docker secret create jwt_key - 2>/dev/null || (printf "%s" '${{ secrets.JWT_KEY }}' | docker secret rm jwt_key && printf "%s" '${{ secrets.JWT_KEY }}' | docker secret create jwt_key -)
|
||||
printf "%s" '${{ secrets.DB_SA_PASSWORD_SECRET }}' | docker secret create db_password - 2>/dev/null || (printf "%s" '${{ secrets.DB_SA_PASSWORD_SECRET }}' | docker secret rm db_password && printf "%s" '${{ secrets.DB_SA_PASSWORD_SECRET }}' | docker secret create db_password -)
|
||||
|
||||
# 4. Desplegar el Stack
|
||||
echo "Desplegando el stack..."
|
||||
docker stack deploy \
|
||||
-c /opt/gestion-integral/docker-compose.yml \
|
||||
--with-registry-auth \
|
||||
gestion-integral
|
||||
|
||||
# 4. Limpieza
|
||||
# 5. Limpieza (sin cambios)
|
||||
echo "Realizando limpieza..."
|
||||
rm -rf "$TEMP_DIR"
|
||||
docker image prune -af --filter "until=24h"
|
||||
|
||||
echo "--- DESPLIEGUE COMPLETADO CON ÉXITO ---"
|
||||
echo "Tiempo total: $(($SECONDS / 60)) minutos y $(($SECONDS % 60)) segundos"
|
||||
EOSSH
|
||||
Reference in New Issue
Block a user