-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (44 loc) · 1.7 KB
/
Copy pathMakefile
File metadata and controls
49 lines (44 loc) · 1.7 KB
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
41
42
43
44
45
46
47
48
49
include .env.local
export
NAME := "github-actions-serverless-lambda-python"
PROFILE := ${AWS_PROFILE}
REGION := "us-east-2"
BRANCH := $$(git rev-parse --abbrev-ref HEAD)
TAG := ${BRANCH}
ifeq ($(TAG),"master")
TAG = "latest"
endif
--repo:
git init
gh repo create liaison-inc/${NAME}
--ecr:
aws ecr create-repository --profile ${PROFILE} --region ${REGION} --repository-name ${NAME}
--ecr-delete:
aws ecr delete-repository --profile ${PROFILE} --region ${REGION} --repository-name ${NAME}
--remove:
$(docker rmi $(docker images -q ${NAME}) -f) \
$(docker rmi $(docker images -f dangling=true -q) -f)
--push:
git add .
git diff-index --quiet HEAD || git commit -am "update"
git push origin ${BRANCH}
#####################################################################################################################
#####################################################################################################################
#####################################################################################################################
#####################################################################################################################
#####################################################################################################################
init:
make -- --repo
make -- --ecr
clean:
make -- --remove
make -- --ecr-delete
build:
docker build -t ${NAME}:${TAG} .
deploy:
make build
make -- --push
docker --version; \
$$(aws ecr --profile ${PROFILE} get-login --region ${REGION} --no-include-email); \
docker tag ${NAME}:${TAG} 773024094974.dkr.ecr.${REGION}.amazonaws.com/${NAME}:${TAG}; \
docker push 773024094974.dkr.ecr.${REGION}.amazonaws.com/${NAME}:${TAG}