-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbitbucket-pipelines.yml
144 lines (125 loc) · 4.35 KB
/
bitbucket-pipelines.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
image:
name: atlassian/pipelines-awscli:1.18.190
options:
size: 2x
docker: true
definitions:
scripts:
- script: &buildPushTag
apt install curl wget unzip -y && curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.0.30.zip" -o "awscliv2.zip";
unzip awscliv2.zip && ./aws/install;
aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin $CWH_ECR;
docker build --memory 2G --memory-swap 4G -t $IMAGE_NAME_TAG-api -f apps/api/Dockerfile-prod .;
docker push $IMAGE_NAME_TAG-api;
docker build -t $IMAGE_NAME_TAG-iverify -f apps/iverify/Dockerfile .;
docker push $IMAGE_NAME_TAG-iverify;
docker build -t $IMAGE_NAME_TAG-triage -f apps/triage/Dockerfile-prod .;
docker push $IMAGE_NAME_TAG-triage;
docker build -t $IMAGE_NAME_TAG-publisher -f apps/publisher/Dockerfile-prod .;
docker push $IMAGE_NAME_TAG-publisher;
- script: &iverifybuild
npm install npm@latest -g;
apt-get update;
apt-get install -y libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 xvfb;
cd apps/iverify;
npm install;
npm install font-awesome;
export PATH=node_modules/.bin:$PATH;
npm install -g @angular/cli;
npm install -g nx;
ng build iverify --configuration=$CONFIGURATION;
cd ../../;
npm install;
nx build triage;
nx build publisher;
kenia: &kenia
script:
- export IMAGE_NAME=$CWH_ECR/$BITBUCKET_REPO_SLUG
- export IMAGE_NAME_TAG=$IMAGE_NAME:kenia-$BITBUCKET_TAG
- export CONFIGURATION=kenia-production
- *iverifybuild
- *buildPushTag
kenia-dev: &kenia-dev
script:
- export IMAGE_NAME=$CWH_ECR/$BITBUCKET_REPO_SLUG
- export IMAGE_NAME_TAG=$IMAGE_NAME:kenia-$BITBUCKET_TAG
- export CONFIGURATION=kenia-development
- *iverifybuild
- *buildPushTag
honduras: &honduras
script:
- export IMAGE_NAME=$CWH_ECR/$BITBUCKET_REPO_SLUG
- export IMAGE_NAME_TAG=$IMAGE_NAME:honduras-$BITBUCKET_TAG
- export CONFIGURATION=honduras-production
- apt install curl wget unzip -y && curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip";
- *iverifybuild
- *buildPushTag
honduras-dev: &honduras-dev
script:
- export IMAGE_NAME=$CWH_ECR/$BITBUCKET_REPO_SLUG
- export IMAGE_NAME_TAG=$IMAGE_NAME:honduras-$BITBUCKET_TAG
- export CONFIGURATION=honduras-development
- *iverifybuild
- *buildPushTag
services:
docker:
memory: 4096
checkRepo: &checkRepo
name: Check & create repo
script:
- REPO=$(aws ecr describe-repositories --region eu-west-1 --query "repositories[?repositoryName=='${BITBUCKET_REPO_SLUG}'].repositoryName" --output text)
- if [[ -z $REPO ]]; then aws ecr create-repository --region eu-west-1 --repository-name $BITBUCKET_REPO_SLUG; fi
build: &build
name: Build
caches:
- docker
script:
- export IMAGE_NAME_TAG=build
- *iverifybuild
- docker build --memory 2G --memory-swap 4G -t $IMAGE_NAME_TAG-api -f apps/api/Dockerfile-prod .
- docker build -t $IMAGE_NAME_TAG-iverify -f apps/iverify/Dockerfile .
- docker build -t $IMAGE_NAME_TAG-triage -f apps/triage/Dockerfile-prod .
- docker build -t $IMAGE_NAME_TAG-publisher -f apps/publisher/Dockerfile-prod .
pipelines:
branches:
master:
- parallel:
- step:
name: Build Kenia
image:
name: node:14.17.1
<<: *build
- step:
name: Build Honduras
image:
name: node:14.17.1
<<: *build
tags:
'dev*':
- step:
*checkRepo
- parallel:
- step:
name: Build Kenia
image:
name: node:14.17.1
<<: *kenia-dev
- step:
name: Build Honduras
image:
name: node:14.17.1
<<: *honduras-dev
'v*':
- step:
*checkRepo
- parallel:
- step:
name: Build Kenia
image:
name: node:14.17.1
<<: *kenia
- step:
name: Build Honduras
image:
name: node:14.17.1
<<: *honduras