ajuste no drone.yml

This commit is contained in:
Marcus Bohessef 2025-12-12 00:05:22 -03:00
parent 164294fc27
commit 44641a9115
2 changed files with 26 additions and 12 deletions

View file

@ -3,25 +3,36 @@ type: kubernetes
name: deploy-backend
steps:
# ---------------------------------------------------------------
# ETAPA 1 - BUILD + PUSH USANDO PLUGIN DOCKER (SEM KANIKO)
# ---------------------------------------------------------------
- name: build-and-push-backend
image: plugins/docker:latest
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
settings:
registry: in.gohorsejobs.com
repo: gohorsejobs/gohorsejobs-backend
repo: in.gohorsejobs.com/gohorsejobs/gohorsejobs-backend
tags:
- latest
context: backend
dockerfile: backend/Dockerfile
insecure: true
insecure_skip_verify: true
debug: true
username:
from_secret: HARBOR_USERNAME
password:
from_secret: HARBOR_PASSWORD
# ---------------------------------------------------------------
# ETAPA 2 - DEPLOY BACKEND NO K3S
# ---------------------------------------------------------------
- name: deploy-backend
image: bitnami/kubectl:latest
environment:
KUBERNETES_SERVER:
from_secret: K3S_SERVER
@ -31,8 +42,10 @@ steps:
from_secret: K3S_CLIENT_CERT
KUBERNETES_CLIENT_KEY:
from_secret: K3S_CLIENT_KEY
commands:
- mkdir -p ~/.kube
- |
cat <<EOF > ~/.kube/config
apiVersion: v1
@ -55,6 +68,7 @@ steps:
namespace: gohorsejobs
current-context: drone-context
EOF
- echo "Deploying backend..."
- kubectl apply -f k8s/backend-deployment.yaml
- kubectl apply -f k8s/backend-service.yaml
- kubectl apply -f k8s/backend-service.yaml

View file

@ -13,19 +13,19 @@ spec:
metadata:
labels:
app: gohorse-backend
# Para usar Infisical Sidecar, descomente as linhas abaixo:
# annotations:
# infisical.com/managed: "true"
# infisical.com/secret-path: "prod/backend"
spec:
containers:
- name: backend
image: in.gohorsejobs.com/gohorsejobs/gohorsejobs-backend:latest
imagePullPolicy: Always
ports:
- containerPort: 3000
env:
- name: NODE_ENV
value: "production"
imagePullSecrets:
- name: harbor-registry
- name: harbor-registry