forked from mlabouardy/mon-put-instance-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
61 lines (59 loc) · 2.19 KB
/
circle.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
version: 2
jobs:
build:
docker:
- image: golang:1.8
working_directory: /go/src/github.com/mlabouardy/mon-put-instance-data
steps:
- checkout
- run:
name: Install dependencies
command: go get -v
- run:
name: Install required windows dependency
command: GOOS=windows go get github.com/StackExchange/wmi
- run:
name: Install gox
command: go get github.com/mitchellh/gox
- run:
name: Build CLI
command: gox -osarch="linux/amd64 windows/amd64"
- run:
name: Install AWS CLI
command: |
apt-get update
apt-get install -y awscli
chmod +x mon-put-instance-data_windows_amd64.exe mon-put-instance-data_linux_amd64
- run:
name: Push linux CLI to S3
command: aws s3 cp mon-put-instance-data_linux_amd64 s3://mon-put-instance-data/1.0.0/linux/mon-put-instance-data --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
- run:
name: Push windows CLI to S3
command: aws s3 cp mon-put-instance-data_windows_amd64.exe s3://mon-put-instance-data/1.0.0/windows/mon-put-instance-data --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
- run:
name: Upload IAM policy
command: aws s3 cp policy.json s3://mon-put-instance-data/policy.json --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
deploy:
docker:
- image: docker:18.02.0-ce
steps:
- checkout
- setup_remote_docker
- run:
name: Build Docker Image
command: docker build -t mlabouardy/mon-put-instance-data:latest .
- deploy:
name: Push to DockerHub
command: |
docker login -u$DOCKERHUB_LOGIN -p$DOCKERHUB_PASSWORD
docker tag mlabouardy/mon-put-instance-data:latest mlabouardy/mon-put-instance-data:${CIRCLE_SHA1}
docker push mlabouardy/mon-put-instance-data:latest
docker push mlabouardy/mon-put-instance-data:${CIRCLE_SHA1}
workflows:
version: 2
build_deploy:
jobs:
- build
- deploy:
requires:
- build