Skip to content

Commit 0d32aa9

Browse files
authored
Create buildspec.yml
1 parent 4c50400 commit 0d32aa9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

buildspec.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 0.2
2+
3+
phases:
4+
pre_build:
5+
commands:
6+
- echo Logging in to Amazon ECR...
7+
- aws --version
8+
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
9+
- REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME
10+
build:
11+
commands:
12+
- echo Build started on `date`
13+
- echo Building the Docker image...
14+
- docker build -t $REPOSITORY_URI:$IMAGE_TAG .
15+
- docker tag $REPOSITORY_URI:$IMAGE_TAG $REPOSITORY_URI:$IMAGE_TAG
16+
post_build:
17+
commands:
18+
- echo Build completed on `date`
19+
- echo Pushing the Docker images...
20+
- docker push $REPOSITORY_URI:$IMAGE_TAG
21+
- echo Writing image definitions file...
22+
- printf '[{"name":"%s","imageUri":"%s"}]' $CONTAINER_NAME $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
23+
24+
artifacts:
25+
files: imagedefinitions.json

0 commit comments

Comments
 (0)