forked from m1nl/docker-misp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
107 lines (97 loc) · 3.79 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
kind: pipeline
type: docker
name: default
concurrency:
limit: 1
environment:
REGISTRY: "docker.io"
ACCOUNT_PREFIX: "m1nl/"
IMAGE: "misp"
DOCKER_HOST: "tcp://docker:2376"
DOCKER_CERT_PATH: "/certs/client"
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: "1"
steps:
- name: wait_for_docker
image: docker
volumes:
- name: docker-client-certdir
path: /certs/client
commands:
- "until docker info >/dev/null 2>&1; do sleep 5; done"
- name: build_publish_server
image: docker
volumes:
- name: docker-client-certdir
path: /certs/client
environment:
COMPONENT: server
REGISTRY_USERNAME:
from_secret: dockerhub_username
REGISTRY_PASSWORD:
from_secret: dockerhub_password
commands:
- "export $(cat .env | xargs)"
- "docker login -u \"$REGISTRY_USERNAME\" -p \"$REGISTRY_PASSWORD\" \"$REGISTRY\""
- "cd $COMPONENT"
- "export DOCKER_IMAGE=\"$${ACCOUNT_PREFIX}$${IMAGE}-$${COMPONENT}\""
- "docker pull \"$REGISTRY/$DOCKER_IMAGE:latest\" || true"
- "docker build --cache-from \"$REGISTRY/$DOCKER_IMAGE:latest\" --build-arg MISP_TAG=$MISP_TAG --build-arg MODULES_TAG=$MODULES_TAG --build-arg PHP_VER=$PHP_VER -t \"$REGISTRY/$DOCKER_IMAGE:work\" ."
- "[ ! -z \"$DRONE_BRANCH\" ] && docker tag \"$REGISTRY/$DOCKER_IMAGE:work\" \"$REGISTRY/$DOCKER_IMAGE:$DRONE_BRANCH\" && docker push \"$REGISTRY/$DOCKER_IMAGE:$DRONE_BRANCH\""
- "[ ! -z \"$DRONE_TAG\" ] && docker tag \"$REGISTRY/$DOCKER_IMAGE:work\" \"$REGISTRY/$DOCKER_IMAGE:$DRONE_TAG\" && docker push \"$REGISTRY/$DOCKER_IMAGE:$DRONE_TAG\""
- "[ \"$DRONE_BRANCH\" == \"main\" ] && docker tag \"$REGISTRY/$DOCKER_IMAGE:work\" \"$REGISTRY/$DOCKER_IMAGE:latest\" && docker push \"$REGISTRY/$DOCKER_IMAGE:latest\""
- name: build_publish_modules
image: docker
volumes:
- name: docker-client-certdir
path: /certs/client
environment:
COMPONENT: modules
REGISTRY_USERNAME:
from_secret: dockerhub_username
REGISTRY_PASSWORD:
from_secret: dockerhub_password
commands:
- "export $(cat .env | xargs)"
- "docker login -u \"$REGISTRY_USERNAME\" -p \"$REGISTRY_PASSWORD\" \"$REGISTRY\""
- "cd $COMPONENT"
- "export DOCKER_IMAGE=\"$${ACCOUNT_PREFIX}$${IMAGE}-$${COMPONENT}\""
- "docker pull \"$REGISTRY/$DOCKER_IMAGE:latest\" || true"
- "docker build --cache-from \"$REGISTRY/$DOCKER_IMAGE:latest\" --build-arg MISP_TAG=$MISP_TAG --build-arg MODULES_TAG=$MODULES_TAG --build-arg PHP_VER=$PHP_VER -t \"$REGISTRY/$DOCKER_IMAGE:work\" ."
- "[ ! -z \"$DRONE_BRANCH\" ] && docker tag \"$REGISTRY/$DOCKER_IMAGE:work\" \"$REGISTRY/$DOCKER_IMAGE:$DRONE_BRANCH\" && docker push \"$REGISTRY/$DOCKER_IMAGE:$DRONE_BRANCH\""
- "[ ! -z \"$DRONE_TAG\" ] && docker tag \"$REGISTRY/$DOCKER_IMAGE:work\" \"$REGISTRY/$DOCKER_IMAGE:$DRONE_TAG\" && docker push \"$REGISTRY/$DOCKER_IMAGE:$DRONE_TAG\""
- "[ \"$DRONE_BRANCH\" == \"main\" ] && docker tag \"$REGISTRY/$DOCKER_IMAGE:work\" \"$REGISTRY/$DOCKER_IMAGE:latest\" && docker push \"$REGISTRY/$DOCKER_IMAGE:latest\""
- name: notify_failure
image: drillster/drone-email
settings:
host:
from_secret: mail_host
username:
from_secret: mail_username
password:
from_secret: mail_password
from:
from_secret: drone_sender
recipients:
from_secret: drone_recipients
recipients_only: true
when:
status:
- failure
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: docker-client-certdir
path: /certs/client
volumes:
- name: docker-client-certdir
temp: {}
concurrency:
limit: 1
---
kind: signature
hmac: 1ffb719a5a1616ee954dba0dcdc77575193290612f85aadf9a2d9821a393f474
...