add buildspec.yml file

This commit is contained in:
unknown 2023-08-18 19:17:17 -04:00
parent 4437cf8248
commit cb9be5391d
2 changed files with 8 additions and 7 deletions

View file

@ -3,17 +3,22 @@ version: 0.2
phases: phases:
install: install:
runtime-versions: runtime-versions:
java: corretto17 java: openjdk8
pre_build: pre_build:
commands: commands:
- echo Nothing to do in prebuild - AWS_ACC=$(echo $CODEBUILD_BUILD_ARN | cut -d':' -f5)
- REPOSITORY_URI=$AWS_ACC.dkr.ecr.$AWS_REGION.amazonaws.com
build: build:
commands: commands:
- echo Build started on `date` - echo Build started on `date`
- mvn package - mvn package
- docker build . -t $REPOSITORY_URI/${REPO}:latest
- echo Build completed on `date`
post_build: post_build:
commands: commands:
- echo Build completed on `date` - $(aws ecr get-login --region $AWS_REGION --no-include-email)
- aws ecr describe-repositories --registry-id ${AWS_ACC} --repository-name ${REPO}
- docker push $REPOSITORY_URI/${REPO}:latest
artifacts: artifacts:
files: files:
- target/spring-petclinic-2.2.0.BUILD-SNAPSHOT.jar - target/spring-petclinic-2.2.0.BUILD-SNAPSHOT.jar

View file

@ -5,7 +5,3 @@ Parameters:
Type: String Type: String
AllowedPattern: (?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._-][a-z0-9]+)* AllowedPattern: (?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._-][a-z0-9]+)*
Resources: Resources:
ECRRepository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Ref RepoName