Last active
March 19, 2020 04:02
-
-
Save likejazz/ba41d83fc94dbb75b982f4e37dc008b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare TARGET="ec2-XXXX.ap-northeast-2.compute.amazonaws.com" | |
readonly VERSION=$(date '+%y.%m.%d') # Today's yy.mm.dd ubuntu version style. | |
readonly IMAGE_NAME=edith/edith-XXXX | |
readonly ECR_REGISTRY=09960362XXXX.dkr.ecr.ap-northeast-2.amazonaws.com/edith/edith-XXXX | |
readonly AWS_OTP=$(aws ecr get-login-password --region ap-northeast-2) | |
# Build | |
docker build -t ${IMAGE_NAME} . | |
# Push | |
echo "${AWS_OTP}" | docker login --username AWS --password-stdin ${ECR_REGISTRY} | |
docker tag edith/edith-XXXX:latest ${ECR_REGISTRY}:"${VERSION}" | |
docker push ${ECR_REGISTRY}:"${VERSION}" | |
# Deploy | |
ssh -i ~/.ssh/aws_skpark.pem ec2-user@${TARGET} "./update-docker.sh ${AWS_OTP}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment