feat: simplify blog lambda deployment pipeline

This commit is contained in:
Daisuke Nakahara 2026-01-11 17:03:10 +09:00
parent 04237038fe
commit a59a8e6461
3 changed files with 166 additions and 23 deletions

View file

@ -6,6 +6,7 @@ phases:
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $ECR_REPOSITORY_URI
- IMAGE_TAG=$(date +%s)
- echo "Image tag will be ${IMAGE_TAG}"
- if [ -z "${ECR_REPOSITORY_NAME:-}" ]; then ECR_REPOSITORY_NAME="${ECR_REPOSITORY_URI##*/}"; fi
build:
commands:
- echo Build started on `date`
@ -18,3 +19,10 @@ phases:
- docker push $ECR_REPOSITORY_URI:$IMAGE_TAG
- docker push $ECR_REPOSITORY_URI:latest
- echo "Image pushed with tags ${IMAGE_TAG} and latest"
- IMAGE_DIGEST=$(aws ecr describe-images --repository-name "$ECR_REPOSITORY_NAME" --image-ids imageTag="$IMAGE_TAG" --query "imageDetails[0].imageDigest" --output text)
- echo "IMAGE_TAG=${IMAGE_TAG}" > image-details.env
- echo "IMAGE_DIGEST=${IMAGE_DIGEST}" >> image-details.env
artifacts:
files:
- image-details.env