Files
GestionIntegralWeb/.drone.yml

78 lines
1.9 KiB
YAML
Raw Normal View History

kind: pipeline
type: docker
name: Build y Deploy
trigger:
branch:
- main
event:
- push
steps:
- name: build-and-publish-backend
image: plugins/docker
settings:
registry:
from_secret: REGISTRY_URL
username:
from_secret: GITEA_USER
password:
from_secret: ACTIONS_PAT
repo: ${{DRONE_REPO_OWNER}}/${{DRONE_REPO_NAME}}-backend
dockerfile: Backend/GestionIntegral.Api/Dockerfile
tags:
- latest
2025-06-15 22:38:22 -03:00
- ${{DRONE_COMMIT_SHA:0:8}}
- name: build-and-publish-frontend
image: plugins/docker
settings:
registry:
from_secret: REGISTRY_URL
username:
from_secret: GITEA_USER
password:
from_secret: ACTIONS_PAT
repo: ${{DRONE_REPO_OWNER}}/${{DRONE_REPO_NAME}}-frontend
dockerfile: Frontend/Dockerfile
tags:
- latest
- ${{DRONE_COMMIT_SHA:0:8}}
depends_on:
- build-and-publish-backend
- name: deploy-to-production
image: appleboy/drone-ssh
settings:
host:
from_secret: PROD_SERVER_HOST
username:
from_secret: PROD_SERVER_USER
key:
from_secret: PROD_SERVER_SSH_KEY
2025-06-15 22:38:22 -03:00
environment:
SA_PASSWORD:
from_secret: DB_SA_PASSWORD_SECRET
JWT_KEY:
from_secret: JWT_KEY_SECRET
REGISTRY:
from_secret: REGISTRY_URL
GITEA_USER:
from_secret: GITEA_USER
GITEA_PAT:
from_secret: ACTIONS_PAT
commands:
- cd /opt/gestion-integral
2025-06-15 22:42:58 -03:00
# Exportamos las variables para que 'docker compose' las lea.
# El doble '$$' escapa la variable para el parser de Drone.
- export DB_SA_PASSWORD=$${SA_PASSWORD}
- export JWT_KEY=$${JWT_KEY}
# El login también usa las variables escapadas.
- docker login $${REGISTRY} -u $${GITEA_USER} -p $${GITEA_PAT}
- docker compose pull
- docker compose up -d
- docker image prune -af
depends_on:
- build-and-publish-frontend