-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
72 lines (64 loc) · 1.9 KB
/
.drone.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
kind: pipeline
type: kubernetes
name: Production Pipeline
###################################################### trigger
trigger:
branch:
- main
when:
event:
exclude:
- pull_request
################################################### build-push
steps:
- name: build-push
image: docker:dind
environment:
DOCKER_HUB_USERNAME:
from_secret: DOCKER_HUB_USERNAME
DOCKER_HUB_PASSWORD:
from_secret: DOCKER_HUB_PASSWORD
volumes:
- name: dockersock
path: /var/run
privileged: true
commands:
- sleep 5 ## give docker enough time to start
- docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD #ou qualquer registry
- docker build -t $DRONE_REPO:$DRONE_BUILD_NUMBER -t $DRONE_REPO:latest -f ./.nixpacks/Dockerfile .
- docker push --all-tags $DRONE_REPO
- name: git-push
image: appleboy/drone-git-push
pull: if-not-exists
settings:
branch: main
remote: [email protected]:kub3dev/devops.git
ssh_key:
from_secret: GITHUB_SSH_KEY
force: true
commit: true
commit_message: "Deploying version $DRONE_BUILD_NUMBER"
commands:
- git pull
- cd apps/production/$DRONE_REPO_NAME
- sed -E -i.bak 's%($DRONE_REPO:).*%$DRONE_REPO:$DRONE_BUILD_NUMBER%' deployment.yaml
- git add .
###################################################### Delivery
- name: delivery
image: kub3dev/drone-deploy-version:1.0
commands:
- git clone [email protected]:kub3dev/devops.git
- cd apps/production/$DRONE_REPO_NAME
- sed -E -i.bak 's%($DRONE_REPO:).*%$DRONE_REPO:$DRONE_BUILD_NUMBER%' deployment.yaml
- git add . && git commit -m "Change image site-poc to $DRONE_REPO:$DRONE_BUILD_NUMBER" && git push
######################################################## Services
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}