-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathMakefile.lambda
40 lines (33 loc) · 1.68 KB
/
Makefile.lambda
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
35
36
37
38
39
40
# public.ecr.aws/l1s5s8m2 is the public ecr repository for integration testing
# Override variables below by setting environment variables and running. Example:
# AWS_ACCOUNT=123456789012 AWS_REGION=us-east-1 LAMBDA_CONTAINER_REPO_NAME=iambic-ecr-public/iambic/iambic PROFILE_NAME=PROFILE make -f Makefile.lambda auth_to_ecr upload_docker_lambda
AWS_ACCOUNT ?= "442632209887"
AWS_REGION ?= "us-west-2"
LAMBDA_ECR_REPO ?= "$(AWS_ACCOUNT).dkr.ecr.$(AWS_REGION).amazonaws.com"
LAMBDA_CONTAINER_REPO_NAME ?= "iambic_private_ecr"
LAMBDA_IMAGE_LABEL ?= "latest"
PROFILE_NAME ?= "iambic_test_org_spoke_account_1/iambic_test_org_spoke_account_1_admin"
.PHONY: prepare_for_dist
prepare_for_dist:
rm -f proposed_changes.yaml # especially important if this is run locally
# skipping linux/arm64 to speed up functional_tests
# our self-hosted runner is linux/amd64, cross-platform
# building was really slow
docker_buildx_lambda := docker buildx build \
--platform=linux/amd64 \
--progress=plain \
-t "${LAMBDA_ECR_REPO}/${LAMBDA_CONTAINER_REPO_NAME}:${LAMBDA_IMAGE_LABEL}"
.PHONY: auth_to_ecr
auth_to_ecr:
# Only run this target if you need to build your own IMAGE and push to your own ECR
# If you are, (most won't), you need to change the AWS_PROFILE to the one that has
# access to push to the desired registry.
aws --profile ${PROFILE_NAME} ecr get-login-password --region $(AWS_REGION) | docker login --username AWS --password-stdin ${LAMBDA_ECR_REPO}
.PHONY: build_docker_lambda
build_docker_lambda: prepare_for_dist
@echo "--> Creating Iambic Docker image"
$(docker_buildx_lambda) .
.PHONY: upload_docker_lambda
upload_docker_lambda:
@echo "--> Uploading Iambic Docker image"
$(docker_buildx_lambda) --push .