-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (37 loc) · 1.21 KB
/
Copy pathMakefile
File metadata and controls
47 lines (37 loc) · 1.21 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
at := @
TAG := $(shell which git > /dev/null && git describe --match 'v[0-9]*\.[0-9]*\.[0-9]*' || echo unknown)
REGISTRY = 053262612181.dkr.ecr.us-west-2.amazonaws.com
IMAGE = $(REGISTRY)/postfix
STAGE ?= dev
AWSCLI_VERSION:=$(shell brew list --versions awscli | awk '{ gsub(/\..*/,"",$$2) ; print $$2 }')
all : build
full : build-no-cache
build : login$(AWSCLI_VERSION)
$(at)docker build --pull -t $(IMAGE):$(STAGE) src
build-no-cache : login$(AWSCLI_VERSION)
$(at)docker build --pull --no-cache -t $(IMAGE):$(STAGE) src
login :
echo "AWS CLI must be installed to push images to AWS ECR". ; \
echo "https://aws.amazon.com/cli" ; \
exit 1
login1 :
@echo Running AWS cli ECR login version 1
eval $$(aws ecr get-login --no-include-email --region us-west-2) ; \
login2 :
@echo Running AWS cli ECR login version 2
aws ecr get-login-password \
| docker login \
--password-stdin \
--username AWS \
https://$(REGISTRY)
tag : build
$(at)if [ x"$(TAG)" != xunknown ] ; then \
docker tag $(IMAGE):$(STAGE) $(IMAGE):$(TAG) ; \
fi
push : tag
$(at)if [ x"$(TAG)" != xunknown ] ; then \
docker push $(IMAGE):$(STAGE) ; \
docker push $(IMAGE):$(TAG) ; \
fi
devprd opsqa opsprd :
$(MAKE) STAGE=$@ build push