73 lines
1.7 KiB
YAML
73 lines
1.7 KiB
YAML
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
|
|
- ${{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
|
|
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
|
|
- export DB_SA_PASSWORD=$SA_PASSWORD
|
|
- export JWT_KEY=$JWT_KEY
|
|
- 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 |