forked from mystatus/covid19-reports
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (40 loc) · 1.34 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Makefile for building se-ingest-router
BUILD_DATE ?= $(strip $(shell date -u +"%Y-%m-%dT%H:%M:%SZ"))
ENVIRONMENT ?= development
APPNAME ?= dds-covid19-reports
SHA ?= $(shell git rev-parse --short HEAD)
BRANCH ?= $(shell git rev-parse --symbolic-full-name --abbrev-ref HEAD)
DOCKER_BRANCH ?= $(subst /,-,$(BRANCH))
DOCKER_TAG=$(ENVIRONMENT)-$(DOCKER_BRANCH)-$(SHA)
VERSION ?= 7.10.7
NAMESPACE ?= default
AWS_ACCT ?= 519479409477
REGION ?= us-gov-west-1
DOCKER_REPO ?= $(AWS_ACCT).dkr.ecr.$(REGION).amazonaws.com/$(APPNAME)
DOCKER_IMG ?= $(DOCKER_REPO):$(DOCKER_TAG)
# vault secrets
NPM_TOKEN ?=
all: build push
default: build
login:
aws ecr \
get-login-password \
--region $(REGION) | \
docker login \
--username AWS \
--password-stdin $(AWS_ACCT).dkr.ecr.$(REGION).amazonaws.com
build:
docker build \
--no-cache=true \
--force-rm \
--network=host \
--build-arg BUILD_DATE=$(BUILD_DATE) \
--build-arg NPM_TOKEN=$(NPM_TOKEN) \
-t $(DOCKER_REPO):$(APPNAME)-$(ENVIRONMENT)-latest \
-t $(DOCKER_IMG) .
push:
docker push $(DOCKER_IMG)
docker push $(DOCKER_REPO):$(APPNAME)-$(ENVIRONMENT)-latest
ls list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
.PHONY: login build push ls list