-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec.yml
More file actions
26 lines (24 loc) · 862 Bytes
/
buildspec.yml
File metadata and controls
26 lines (24 loc) · 862 Bytes
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
version: 0.2
phases:
pre_build:
commands:
- echo "Login to ECR"
- aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com
build:
commands:
- cd my-maven-docker-project
- mvn clean install
post_build:
commands:
- echo "Build Completed Successfully"
- ls -l target/
- docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG .
- docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
- docker images
- echo "Docker Push to ECR"
- docker push $AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
- echo "Docker Pushed Successfully"
artifacts:
files:
- "my-maven-docker-project/target/*.jar"
discard-paths: yes