Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroGlezC authored May 10, 2024
1 parent 6b074e1 commit d359ca0
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,53 @@ jobs:
- name: Delete images
run: |
az acr login --name ${{ secrets.AZURE_REGISTRY_NAME }}
# Si la imagen existe, eliminarla, si no, imprimir mensaje
# Si las imagenes existen, eliminarlsa, si no, imprimir mensaje
az acr repository show-manifests --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-docker-db" --query "[?tags[0]=='0.1.0-SNAPSHOT']" > /dev/null 2>&1 \
&& az acr repository delete --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-docker-d" --image "0.1.0-SNAPSHOT" --yes \
|| echo "Image 'syg-docker-d:0.1.0-SNAPSHOT' does not exist, skipping deletion."
&& az acr repository delete --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-docker-db" --image "0.1.0-SNAPSHOT" --yes \
|| echo "Image 'syg-docker-db:0.1.0-SNAPSHOT' does not exist, skipping deletion."
az acr repository show-manifests --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-backend" --query "[?tags[0]=='0.1.0-SNAPSHOT']" > /dev/null 2>&1 \
&& az acr repository delete --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-backend" --image "0.1.0-SNAPSHOT" --yes \
|| echo "Image 'syg-backend:0.1.0-SNAPSHOT' does not exist, skipping deletion."
az acr repository show-manifests --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-keycloak" --query "[?tags[0]=='0.1.0-SNAPSHOT']" > /dev/null 2>&1 \
&& az acr repository delete --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-keycloak" --image "0.1.0-SNAPSHOT" --yes \
|| echo "Image 'syg-keycloak:0.1.0-SNAPSHOT' does not exist, skipping deletion."
az acr repository show-manifests --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-frontend" --query "[?tags[0]=='0.1.0-SNAPSHOT']" > /dev/null 2>&1 \
&& az acr repository delete --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-frontend" --image "0.1.0-SNAPSHOT" --yes \
|| echo "Image 'syg-frontend:0.1.0-SNAPSHOT' does not exist, skipping deletion."
az acr repository show-manifests --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-prometheus" --query "[?tags[0]=='0.1.0-SNAPSHOT']" > /dev/null 2>&1 \
&& az acr repository delete --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-prometheus" --image "0.1.0-SNAPSHOT" --yes \
|| echo "Image 'syg-prometheus:0.1.0-SNAPSHOT' does not exist, skipping deletion."
az acr repository show-manifests --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-grafana" --query "[?tags[0]=='0.1.0-SNAPSHOT']" > /dev/null 2>&1 \
&& az acr repository delete --name ${{ secrets.AZURE_REGISTRY_NAME }} --repository "syg-grafana" --image "0.1.0-SNAPSHOT" --yes \
|| echo "Image 'syg-grafana:0.1.0-SNAPSHOT' does not exist, skipping deletion."
- name: Push images
run: |
docker build -f ./docker/database-mysql.Dockerfile -t ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-docker-db:0.1.0-SNAPSHOT ./docker
docker push ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-docker-db:0.1.0-SNAPSHOT
docker build -f ./syg-backend/SYG-bootstrap/src/docker/backend.Dockerfile -t ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-backend:0.1.0-SNAPSHOT ./docker
docker push ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-backend:0.1.0-SNAPSHOT
docker build -f ./docker/keycloak/keycloak.Dockerfile -t ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-keycloak:0.1.0-SNAPSHOT ./docker
docker push ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-keycloak:0.1.0-SNAPSHOT
docker build -f ./syg-frontend/frontend.Dockerfile -t ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-frontend:0.1.0-SNAPSHOT ./docker
docker push ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-frontend:0.1.0-SNAPSHOT
docker build -f ./docker/prometheus.Dockerfile -t ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-prometheus:0.1.0-SNAPSHOT ./docker
docker push ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-prometheus:0.1.0-SNAPSHOT
docker build -f ./docker/grafana.Dockerfile -t ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-grafana:0.1.0-SNAPSHOT ./docker
docker push ${{ secrets.AZURE_REGISTRY_NAME }}.azurecr.io/syg-grafana:0.1.0-SNAPSHOT
- name: Stop Container in Azure Container Instances
run: az container stop --name syg-docker-db --resource-group syg-demo
- name: Stop All Containers in syg resource Group
run: |
# Obtener todos los contenedores en el grupo de recursos
containers=$(az container list --resource-group syg-demo --query "[].name" --output tsv)
# Recorrer cada contenedor y detenerlo
for container in $containers; do
az container stop --name $container --resource-group syg-demo
done
- name: Start Container in Azure Container Instances
run: az container start --name syg-docker-db --resource-group syg-demo
- name: Start All Containers in syg resource Group
run: |
# Recorrer cada contenedor y arrancarlo
for container in $containers; do
az container start --name $container --resource-group syg-demo
done

0 comments on commit d359ca0

Please sign in to comment.