gohorsejobs/.drone.yml
2025-12-12 15:41:54 -03:00

52 lines
2 KiB
YAML

kind: pipeline
type: kubernetes
name: deploy-backend
steps:
- name: build-and-push-backend
image: plugins/docker:latest
settings:
registry: in.gohorsejobs.com
repo: in.gohorsejobs.com/gohorsejobs/gohorsejobs-backend
tags: [latest]
context: backend
dockerfile: backend/Dockerfile
insecure: true
insecure_skip_verify: true
username:
from_secret: HARBOR_USERNAME
password:
from_secret: HARBOR_PASSWORD
- name: export-envs-to-k8s
image: bitnami/kubectl:latest
environment:
AWS_ACCESS_KEY_ID: { from_secret: AWS_ACCESS_KEY_ID }
AWS_ENDPOINT: { from_secret: AWS_ENDPOINT }
AWS_REGION: { from_secret: AWS_REGION }
AWS_SECRET_ACCESS_KEY: { from_secret: AWS_SECRET_ACCESS_KEY }
CORS_ORIGINS: { from_secret: CORS_ORIGINS }
DB_HOST: { from_secret: DB_HOST }
DB_NAME: { from_secret: DB_NAME }
DB_PASSWORD: { from_secret: DB_PASSWORD }
DB_PORT: { from_secret: DB_PORT }
DB_SSLMODE: { from_secret: DB_SSLMODE }
DB_USER: { from_secret: DB_USER }
ENV: { from_secret: ENV }
JWT_SECRET: { from_secret: JWT_SECRET }
MAX_UPLOAD_CAD_SIZE: { from_secret: MAX_UPLOAD_CAD_SIZE }
PORT: { from_secret: PORT }
S3_BUCKET: { from_secret: S3_BUCKET }
UPLOAD_DIR: { from_secret: UPLOAD_DIR }
commands:
- kubectl get ns
- kubectl -n gohorsejobs delete secret backend-secrets --ignore-not-found
- kubectl -n gohorsejobs create secret generic backend-secrets --from-env-file=.env.k8s
- name: deploy-backend
image: bitnami/kubectl:latest
commands:
- kubectl get pods -n gohorsejobs
- kubectl apply -n gohorsejobs -f k8s/backend-deployment.yaml
- kubectl apply -n gohorsejobs -f k8s/backend-service.yaml