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 name: deploy-backend
steps: steps:
# ---------------------------------------------------------------
# ETAPA 1 - BUILD + PUSH USANDO PLUGIN DOCKER (SEM KANIKO)
# ---------------------------------------------------------------
- name: build-and-push-backend - name: build-and-push-backend
image: plugins/docker:latest image: plugins/docker:latest
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
settings: settings:
registry: in.gohorsejobs.com registry: in.gohorsejobs.com
repo: gohorsejobs/gohorsejobs-backend repo: in.gohorsejobs.com/gohorsejobs/gohorsejobs-backend
tags: tags:
- latest - latest
context: backend context: backend
dockerfile: backend/Dockerfile dockerfile: backend/Dockerfile
insecure: true insecure: true
insecure_skip_verify: 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 - name: deploy-backend
image: bitnami/kubectl:latest image: bitnami/kubectl:latest
environment: environment:
KUBERNETES_SERVER: KUBERNETES_SERVER:
from_secret: K3S_SERVER from_secret: K3S_SERVER
@ -31,8 +42,10 @@ steps:
from_secret: K3S_CLIENT_CERT from_secret: K3S_CLIENT_CERT
KUBERNETES_CLIENT_KEY: KUBERNETES_CLIENT_KEY:
from_secret: K3S_CLIENT_KEY from_secret: K3S_CLIENT_KEY
commands: commands:
- mkdir -p ~/.kube - mkdir -p ~/.kube
- | - |
cat <<EOF > ~/.kube/config cat <<EOF > ~/.kube/config
apiVersion: v1 apiVersion: v1
@ -55,6 +68,7 @@ steps:
namespace: gohorsejobs namespace: gohorsejobs
current-context: drone-context current-context: drone-context
EOF EOF
- echo "Deploying backend..." - echo "Deploying backend..."
- kubectl apply -f k8s/backend-deployment.yaml - 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: metadata:
labels: labels:
app: gohorse-backend app: gohorse-backend
# Para usar Infisical Sidecar, descomente as linhas abaixo:
# annotations:
# infisical.com/managed: "true"
# infisical.com/secret-path: "prod/backend"
spec: spec:
containers: containers:
- name: backend - name: backend
image: in.gohorsejobs.com/gohorsejobs/gohorsejobs-backend:latest image: in.gohorsejobs.com/gohorsejobs/gohorsejobs-backend:latest
imagePullPolicy: Always imagePullPolicy: Always
ports: ports:
- containerPort: 3000 - containerPort: 3000
env: env:
- name: NODE_ENV - name: NODE_ENV
value: "production" value: "production"
imagePullSecrets: imagePullSecrets:
- name: harbor-registry - name: harbor-registry