WIP commit to create a comparison with the ECS blue green repo,

specifically the fargate branch changes.
This commit is contained in:
Joe Bailey 2023-02-12 15:21:47 -08:00
parent 517d5e0979
commit 008f84a252
2 changed files with 34 additions and 16 deletions

View file

@ -222,13 +222,12 @@ Resources:
- echo -n "$CODEBUILD_LOG_PATH" > /tmp/build_id.out
- printf "%s:%s" "$REPOSITORY_URI" "$(cat /tmp/build_id.out)" > /tmp/build_tag.out
- printf '{"tag":"%s"}' "$(cat /tmp/build_id.out)" > /tmp/build.json
# - $(aws ecr get-login-password)
- echo Logging in to Amazon ECR...
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin "$(aws sts get-caller-identity --query \"Account\" --output text)".dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
build:
commands:
- ./mvnw package
- ./mvnw package -DskipTests
- docker build --tag "$(cat /tmp/build_tag.out)" .
# - ./mvnw spring-boot:build-image
- docker image tag spring-petclinic:3.0.0-SNAPSHOT "$(cat /tmp/build_tag.out)"
post_build:
commands:
- docker push "$(cat /tmp/build_tag.out)"
@ -239,13 +238,12 @@ Resources:
ComputeType: "BUILD_GENERAL1_SMALL"
Image: "aws/codebuild/standard:6.0"
Type: "LINUX_CONTAINER"
PrivilegedMode: true
EnvironmentVariables:
- Name: AWS_DEFAULT_REGION
Value: !Ref AWS::Region
- Name: REPOSITORY_URI
Value: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository}
- Name: DOCKER_HOST
Value: unix:///var/run/docker.sock
Name: !Sub ${AWS::StackName}-codebuildproject
ServiceRole: !Ref CodeBuildServiceRole
@ -259,11 +257,11 @@ Resources:
BuildSpec: |
version: 0.1
phases:
install:
commands:
- pip install --upgrade python
- pip install --upgrade awscli
- pip install --upgrade boto3
# install:
# commands:
# - pip install --upgrade python
# - pip install --upgrade awscli
# - pip install --upgrade boto3
pre_build:
commands:
- printenv
@ -274,7 +272,7 @@ Resources:
discard-paths: yes
Environment:
ComputeType: "BUILD_GENERAL1_SMALL"
Image: aws/codebuild/python:2.7.12
Image: "aws/codebuild/standard:6.0"
Type: "LINUX_CONTAINER"
EnvironmentVariables:
- Name: AWS_DEFAULT_REGION

View file

@ -31,9 +31,7 @@ Parameters:
IsProduction:
Type: String
Resources:
LoadBalancerListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
@ -104,15 +102,37 @@ Resources:
Role: !Ref ECSServiceRole
DesiredCount: !Ref DesiredCount
TaskDefinition: !Ref TaskDefinition
# CapacityProviderStrategy:
# - CapacityProvider: FARGATE
# - Base: 0
# - Weight: 1
LoadBalancers:
- ContainerName: simple-app
ContainerPort: 80
TargetGroupArn: !Ref TargetGroup
# NetworkConfiguration:
# - AwsvpcConfiguration:
# - AssignPublicIp: ENABLED
# - SecurityGroups:
# - Ref: SecurityGroupIDs
# - Subnets: !!omap
# - Ref: SubnetIDs
PlatformVersion: LATEST
# DeploymentConfiguration:
# - MaximumPercent: 200
# - MinimumHealthyPercent: 100
# - DeploymentCircuitBreaker:
# - Enable: true
# - Rollback: true
# DeploymentController:
# - Type: ECS
# ServiceConnectConfiguration:
# - Enabled: false
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
#Family: !Sub ${AWS::StackName}-simple-app
Family: !Sub ${AWS::StackName}-simple-app
ContainerDefinitions:
- Name: simple-app
Image: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository}:${Tag}