Advertisement
Sergio_Istea

entrypoint dashboard

May 23rd, 2024
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.91 KB | None | 0 0
  1. #!/bin/bash
  2. set -e
  3.  
  4. # instalar apache2 y git
  5.  
  6. apt update && apt install apache2 git -y
  7.  
  8.  
  9. # clonar repositorio via https
  10.  
  11. git clone https://gitlab.com/sergio.pernas1/dashboard.git /app
  12.  
  13.  
  14. # Definir en que rama se debe desplegar al aplicacion
  15.  
  16. # ${BRANCHAPP:-main} si la variable esta vacia porque no se definio al momento de lanzar el contenedor
  17. # entonces se rellna con la cadena 'main' para evitar el error de operador unario de bash a la hora
  18. # de evaluar la condicion.
  19.  
  20.  
  21. if [ $BRANCHAPP == 'main' ];then
  22.  
  23.     cd /app && git checkout main
  24.  
  25. elif [ $BRANCHAPP == 'testing' ];then
  26.  
  27.     cd /app && git checkout testing
  28.  
  29. elif [ $BRANCHAPP == 'develop' ];then
  30.  
  31.     cd /app && git checkout develop
  32.  
  33. else
  34.     echo "se debe indicar la rama -v BRANCHAPP=main|testing|develop"
  35.     exit 1
  36.  
  37.  
  38. if 
  39.  
  40.  
  41. cp /app/apache2.conf /etc/apache2/apache2.conf
  42. cp /app/000-default.conf /etc/apache2/sites-available/
  43.  
  44.  
  45. exec $@
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement