-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (26 loc) · 974 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
AWS_REGION := $(shell eval "aws --profile default configure get region")
IMAGE_TAG := latest
ECR_NAME := ecr
IMAGE_NAME := api-testing
REPO_NAME := repo-testing
REGISTRY_ID := $(shell aws ecr \
--profile default \
describe-repositories \
--query 'repositories[?repositoryName == `$(REPO_NAME)`].registryId' \
--output text)
IMAGE_URI := $(REGISTRY_ID).dkr.ecr.$(AWS_REGION).amazonaws.com
ecr-repo:
@echo "** Creating the ECR repository **"
cd terraform && \
terraform apply -target=aws_ecr_repository.$(ECR_NAME) -auto-approve
push-image:
@echo "** Login to AWS ECR **"
aws ecr get-login-password --region $(AWS_REGION) | \
docker login --username AWS --password-stdin $(IMAGE_URI)
@echo "** Building and pushing the container **"
docker build -t $(IMAGE_URI)/$(REPO_NAME) -f api/LambdaDockerfile api/ && \
docker push $(IMAGE_URI)/$(REPO_NAME):$(IMAGE_TAG)
deploy:
@echo "** Deploying"
cd terraform && \
terraform apply -auto-approve