-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuildspec.yml
More file actions
49 lines (46 loc) · 1.95 KB
/
buildspec.yml
File metadata and controls
49 lines (46 loc) · 1.95 KB
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
version: 0.2
env:
variables:
IMAGE_TAG: "latest"
KUBECONFIG: /root/.kube/config
phases:
install:
commands:
- curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
- chmod +x ./kubectl
- mv ./kubectl /usr/local/bin/
- apt-get update
- apt-get install -y awscli
#- aws eks update-kubeconfig --region eu-north-1 --name my-eks-cluster
pre_build:
commands:
- echo "$(aws ecr get-login-password --region eu-north-1)" | docker login --username AWS --password-stdin 944684220857.dkr.ecr.eu-north-1.amazonaws.com$(aws ecr get-login --no-include-email --region eu-north-1)
build:
commands:
- docker build -t 944684220857.dkr.ecr.eu-north-1.amazonaws.com/mynoderepo:$IMAGE_TAG .
- docker push 944684220857.dkr.ecr.eu-north-1.amazonaws.com/mynoderepo:$IMAGE_TAG
post_build:
commands:version: 0.2
env:
variables:
IMAGE_TAG: "latest"
KUBECONFIG: /root/.kube/config
phases:
install:
commands:
- curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
- chmod +x ./kubectl
- mv ./kubectl /usr/local/bin/
- apt-get update
- apt-get install -y awscli
pre_build:
commands:
- echo "$(aws ecr get-login-password --region ${AWS_REGION})" | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com
build:
commands:
- docker build -t ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ECR_REPOSITORY_NAME}:${IMAGE_TAG} .
- docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ECR_REPOSITORY_NAME}:${IMAGE_TAG}
post_build:
commands:
# - kubectl apply --validate=false -f deployment.yaml
# - kubectl apply --validate=false -f deployment.yaml