File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ version : 0.2
2
+
3
+ env :
4
+ environment :
5
+ aws_region : " eu-west-1"
6
+ container_name : " test"
7
+ repository_url : " xxxxxxxxxxxx"
8
+ parameter-store :
9
+ dockerhub_username : " /devops/dev/DOCKERHUB_USERNAME"
10
+ dockerhub_password : " /devops/dev/DOCKERHUB_PASSWORD"
11
+
12
+ phases :
13
+ pre_build :
14
+ commands :
15
+ - echo logging into Dockerhub as upstream not yet using gallery.ecr.aws
16
+ - docker login -u $dockerhub_username -p $dockerhub_password
17
+ - echo logging into ECR
18
+ - $(aws ecr get-login --region $aws_region --no-include-email)
19
+ - REPOSITORY_URI=${repository_url}
20
+ - IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
21
+ build :
22
+ commands :
23
+ - echo build started on $(date)
24
+ - docker build -t $REPOSITORY_URI:latest .
25
+ - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
26
+ post_build :
27
+ commands :
28
+ - echo build completed on $(date)
29
+ - echo pushing the docker images
30
+ - docker push $REPOSITORY_URI:latest
31
+ - docker push $REPOSITORY_URI:$IMAGE_TAG
32
+ - echo writing image definitions file for deployment
33
+ - printf '[{"name":"$container_name","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
34
+
35
+ artifacts :
36
+ files : imagedefinitions.json
You can’t perform that action at this time.
0 commit comments