forked from owncloud-docker/base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.yml
127 lines (112 loc) · 3.39 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
workspace:
base: /var/www
path: base
branches:
- master
clone:
git:
image: plugins/git:1
pull: true
pipeline:
tarball:
image: plugins/download:latest
pull: true
secrets: [ download_username, download_password ]
source: https://download.owncloud.org/community/owncloud-10.0.10.tar.bz2
sha256: a2efe484678c1659b9640ea247746a2174d77870d29c7d60abd565c20eb5aa84
extract:
image: owncloud/ubuntu:latest
pull: true
commands:
- tar -xjf owncloud-10.0.10.tar.bz2 -C /var/www
wait:
image: owncloud/ubuntu:latest
pull: true
commands:
- wait-for-it -t 600 docker:2375
build:
image: toolhippie/docker:latest
pull: true
environment:
- DOCKER_HOST=tcp://docker:2375
commands:
- docker build -t owncloud/base:${DRONE_COMMIT_SHA}-${DRONE_BUILD_NUMBER} .
server:
image: toolhippie/docker:latest
pull: true
detach: true
environment:
- DOCKER_HOST=tcp://docker:2375
commands:
- docker run -p 8000:8080 -v /var/www/owncloud:/var/www/owncloud owncloud/base:${DRONE_COMMIT_SHA}-${DRONE_BUILD_NUMBER}
test:
image: owncloud/ubuntu:latest
pull: true
commands:
- wait-for-it -t 600 docker:8000
- curl -sSf http://docker:8000/status.php
prepublish:
image: toolhippie/docker:latest
pull: true
secrets: [ docker_username, docker_password ]
environment:
- DOCKER_HOST=tcp://docker:2375
commands:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker push owncloud/base:${DRONE_COMMIT_SHA}-${DRONE_BUILD_NUMBER}
when:
event: [ push ]
clair:
image: toolhippie/klar:latest
pull: true
environment:
- CLAIR_ADDR=clair.owncloud.com
- CLAIR_OUTPUT=High
commands:
- klar owncloud/base:${DRONE_COMMIT_SHA}-${DRONE_BUILD_NUMBER}
when:
event: [ push ]
publish:
image: toolhippie/docker:latest
pull: true
secrets: [ docker_username, docker_password ]
environment:
- DOCKER_HOST=tcp://docker:2375
commands:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker tag owncloud/base:${DRONE_COMMIT_SHA}-${DRONE_BUILD_NUMBER} owncloud/base:latest
- docker push owncloud/base:latest
- docker tag owncloud/base:${DRONE_COMMIT_SHA}-${DRONE_BUILD_NUMBER} owncloud/base:latest-$(date '+%Y%m%d')
- docker push owncloud/base:latest-$(date '+%Y%m%d')
when:
event: [ push ]
cleanup:
image: toolhippie/jq:latest
pull: true
secrets: [ docker_username, docker_password ]
commands:
- |
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'"$DOCKER_USERNAME"'", "password": "'"$DOCKER_PASSWORD"'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
curl --fail -o /dev/null -H "Authorization: JWT $TOKEN" -H "Content-Type: application/json" -X DELETE https://hub.docker.com/v2/repositories/owncloud/base/tags/${DRONE_COMMIT_SHA}-${DRONE_BUILD_NUMBER}/
when:
event: [ push ]
status: [ success, failure ]
microbadger:
image: plugins/webhook:1
pull: true
secrets: [ webhook_urls ]
when:
local: false
event: [ push ]
slack:
image: plugins/slack:1
pull: true
secrets: [ slack_webhook ]
channel: docker
when:
local: false
event: [ push ]
status: [ changed, failure ]
services:
docker:
image: docker:18.04-dind