forked from SaiDevOpsFaculty/SaiJavaCode
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuildspecs.yml
More file actions
31 lines (27 loc) · 1.09 KB
/
buildspecs.yml
File metadata and controls
31 lines (27 loc) · 1.09 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
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 569428056424.dkr.ecr.ap-south-1.amazonaws.com
- REPOSITORY_URI=569428056424.dkr.ecr.ap-south-1.amazonaws.com/tomcat
- IMAGE_TAG=build-$(echo $CODEBUILD_BUILD_ID | awk -F":" '{print $2}')
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build -t ${REPOSITORY_URI}:latest .
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 569428056424.dkr.ecr.ap-south-1.amazonaws.com
- docker push ${REPOSITORY_URI}:latest
- echo image pushed.
- printf '[{"name":"container","imageUri":"569428056424.dkr.ecr.ap-south-1.amazonaws.com/sans:latest"}]' > imagedefinitions.json
artifacts:
files:
- imagedefinitions.json
- "**/*.war"
discard-paths: yes