Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit c8199d7

Browse files
authored
update ECR-related Makefile targets to get account ID automatically (#2357)
account ID is based off the AWS_PROFILE currently set in the environment
1 parent ad3f2d8 commit c8199d7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,20 @@ docker-image-featurebase-quick: build-for-quick
266266
docker-image-datagen: vendor
267267
docker build --tag dax/datagen --file Dockerfile-datagen .
268268

269+
get-account-id:
270+
$(eval AWS_ACCOUNTID := $(shell aws sts get-caller-identity --output=json | jq -r .Account))
271+
272+
269273
ecr-push-featurebase: docker-login
274+
echo "Pushing to account $(AWS_ACCOUNTID), profile $(AWS_PROFILE)"
270275
docker tag dax/featurebase:latest $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com/dax/featurebase:latest
271276
docker push $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com/dax/featurebase:latest
272277

273278
ecr-push-datagen: docker-login
274279
docker tag dax/datagen:latest $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com/dax/datagen:latest
275280
docker push $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com/dax/datagen:latest
276281

277-
docker-login:
282+
docker-login: get-account-id
278283
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com
279284

280285
# Create docker image (alias)

0 commit comments

Comments
 (0)