Compare commits
	
		
			10 Commits
		
	
	
		
			401e61e0eb
			...
			b33dd4f94f
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| b33dd4f94f | |||
| ba9bef2364 | |||
| 856d7ac5c1 | |||
| d8dc41222c | |||
| a434640456 | |||
| fcc2b90f15 | |||
| 0d7614ef4c | |||
| ae54ef3fe5 | |||
| c361842a91 | |||
| de079d8bd4 | 
							
								
								
									
										49
									
								
								.drone.yml
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								.drone.yml
									
									
									
									
									
								
							| @@ -2,11 +2,6 @@ kind: pipeline | ||||
| type: docker | ||||
| name: Build y Deploy | ||||
|  | ||||
| volumes: | ||||
|   - name: dockersock | ||||
|     host: | ||||
|       path: /var/run/docker.sock | ||||
|  | ||||
| trigger: | ||||
|   branch: | ||||
|   - main | ||||
| @@ -15,41 +10,33 @@ trigger: | ||||
|  | ||||
| steps: | ||||
| - name: build-and-publish-backend | ||||
|   image: plugins/docker | ||||
|   volumes: | ||||
|     - name: dockersock | ||||
|       path: /var/run/docker.sock | ||||
|   image: plugins/kaniko | ||||
|   settings: | ||||
|     registry: | ||||
|       from_secret: REGISTRY_URL | ||||
|     repo: ${REGISTRY_URL}/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME,,}-backend | ||||
|     repo: host.docker.internal:5000/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME,,}-backend | ||||
|     tags: | ||||
|       - latest | ||||
|       - ${DRONE_COMMIT_SHA:0:8} | ||||
|     dockerfile: Backend/GestionIntegral.Api/Dockerfile | ||||
|     context: . | ||||
|     username: | ||||
|       from_secret: GITEA_USER | ||||
|     password: | ||||
|       from_secret: ACTIONS_PAT | ||||
|     dockerfile: Backend/GestionIntegral.Api/Dockerfile | ||||
|     tags: | ||||
|       - latest | ||||
|       - ${DRONE_COMMIT_SHA:0:8} | ||||
|     insecure: true | ||||
|  | ||||
| - name: build-and-publish-frontend | ||||
|   image: plugins/docker | ||||
|   volumes: | ||||
|     - name: dockersock | ||||
|       path: /var/run/docker.sock | ||||
|   image: plugins/kaniko | ||||
|   settings: | ||||
|     registry: | ||||
|       from_secret: REGISTRY_URL | ||||
|     repo: ${REGISTRY_URL}/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME,,}-frontend | ||||
|     repo: host.docker.internal:5000/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME,,}-frontend | ||||
|     tags: | ||||
|       - latest | ||||
|       - ${DRONE_COMMIT_SHA:0:8} | ||||
|     dockerfile: Frontend/Dockerfile | ||||
|     context: . | ||||
|     username: | ||||
|       from_secret: GITEA_USER | ||||
|     password: | ||||
|       from_secret: ACTIONS_PAT | ||||
|     dockerfile: Frontend/Dockerfile | ||||
|     tags: | ||||
|       - latest | ||||
|       - ${DRONE_COMMIT_SHA:0:8} | ||||
|     insecure: true | ||||
|   depends_on: | ||||
|     - build-and-publish-backend | ||||
| @@ -74,29 +61,21 @@ steps: | ||||
|     GITEA_PAT: | ||||
|       from_secret: ACTIONS_PAT | ||||
|   commands: | ||||
|     # Preparar el entorno SSH | ||||
|     - apk add --no-cache openssh-client | ||||
|     - mkdir -p ~/.ssh | ||||
|     - echo "$SSH_KEY" > ~/.ssh/id_rsa | ||||
|     - chmod 600 ~/.ssh/id_rsa | ||||
|     - ssh-keyscan -H $PROD_HOST >> ~/.ssh/known_hosts | ||||
|  | ||||
|     # Ejecutar comandos remotos | ||||
|     - | | ||||
|       ssh $PROD_USER@$PROD_HOST << 'EOF' | ||||
|         echo "--- CONECTADO AL SERVIDOR DE PRODUCCIÓN ---" | ||||
|         cd /opt/gestion-integral | ||||
|          | ||||
|         # Exportamos las variables que necesita el docker-compose de la app | ||||
|         export DB_SA_PASSWORD="${DB_PASSWORD}" | ||||
|         export JWT_KEY="${JWT_KEY}" | ||||
|          | ||||
|         # Login, pull y deploy | ||||
|         docker login ${REGISTRY} -u ${GITEA_USER} -p ${GITEA_PAT} | ||||
|         docker compose pull | ||||
|         docker compose up -d | ||||
|         docker image prune -af | ||||
|          | ||||
|         echo "--- DESPLIEGUE COMPLETADO ---" | ||||
|       EOF | ||||
|   depends_on: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user