-
Notifications
You must be signed in to change notification settings - Fork 3
/
.drone.yml
71 lines (65 loc) · 2.29 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
---
kind: pipeline
name: default
type: kubernetes
platform:
os: linux
arch: amd64
steps:
- name: build
pull: if-not-exists
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/dind
environment:
IMAGE_NAME: quay.io/ukhomeofficedigital/dind-awscli
commands:
# wait for docker service to be up before running docker build
- n=0; while [ "$n" -lt 60 ] && [ ! docker stats --no-stream ]; do n=$(( n + 1 )); sleep 1; done; if [ ! docker stats --no-stream ]; then exit 1; fi
- docker build -t $${IMAGE_NAME}:$${DRONE_COMMIT_SHA} . --no-cache
when:
event:
- push
- tag
- name: push_latest
pull: if-not-exists
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/dind
environment:
IMAGE_NAME: quay.io/ukhomeofficedigital/dind-awscli
REGISTRY: quay.io
DOCKER_USERNAME: ukhomeofficedigital+dind_awscli
DOCKER_PASSWORD:
from_secret: docker_password
commands:
# wait for docker service to be up before running docker build
- n=0; while [ "$n" -lt 60 ] && [ ! docker stats --no-stream ]; do n=$(( n + 1 )); sleep 1; done; if [ ! docker stats --no-stream ]; then exit 1; fi
- docker login -u="$${DOCKER_USERNAME}" -p="$${DOCKER_PASSWORD}" $${REGISTRY}
- docker tag $${IMAGE_NAME}:$${DRONE_COMMIT_SHA} $${IMAGE_NAME}:latest
- docker push $${IMAGE_NAME}:$${DRONE_COMMIT_SHA}
- docker push $${IMAGE_NAME}:latest
when:
branch:
- master
event:
- push
- name: push_tag
pull: if-not-exists
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/dind
environment:
IMAGE_NAME: quay.io/ukhomeofficedigital/dind-awscli
REGISTRY: quay.io
DOCKER_USERNAME: ukhomeofficedigital+dind_awscli
DOCKER_PASSWORD:
from_secret: docker_password
commands:
# wait for docker service to be up before running docker build
- n=0; while [ "$n" -lt 60 ] && [ ! docker stats --no-stream ]; do n=$(( n + 1 )); sleep 1; done; if [ ! docker stats --no-stream ]; then exit 1; fi
- docker login -u="$${DOCKER_USERNAME}" -p="$${DOCKER_PASSWORD}" $${REGISTRY}
- docker tag $${IMAGE_NAME}:$${DRONE_COMMIT_SHA} $${IMAGE_NAME}:$${DRONE_TAG}
- docker push $${IMAGE_NAME}:$${DRONE_COMMIT_SHA}
- docker push $${IMAGE_NAME}:$${DRONE_TAG}
when:
event:
- tag
services:
- name: docker
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/dind
...