-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
30 lines (22 loc) · 1 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
.PHONY: ecr-login install build tag push pull
DOCKER_REPO ?= ufragments-security-tests
COMMIT_HASH = $(shell git rev-parse --short HEAD)
DOCKER_TAG ?= $(shell whoami)-$(COMMIT_HASH)
DOCKER_TAG_LATEST ?= 'latest'
AWS_ACCOUNT_ID ?= 834138259469
AWS_ECR_REGION ?= us-west-2
AWS_ECR_DOMAIN ?= $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_ECR_REGION).amazonaws.com
ecr-login:
@$(shell aws ecr get-login --no-include-email --region $(AWS_ECR_REGION))
build:
@docker build -t $(DOCKER_REPO):$(DOCKER_TAG) .
tag:
@docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(AWS_ECR_DOMAIN)/$(DOCKER_REPO):$(DOCKER_TAG)
@docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(AWS_ECR_DOMAIN)/$(DOCKER_REPO):$(DOCKER_TAG_LATEST)
push: ecr-login tag
@docker push $(AWS_ECR_DOMAIN)/$(DOCKER_REPO):$(DOCKER_TAG)
@docker push $(AWS_ECR_DOMAIN)/$(DOCKER_REPO):$(DOCKER_TAG_LATEST)
pull: ecr-login
@docker pull $(AWS_ECR_DOMAIN)/$(DOCKER_REPO):$(DOCKER_TAG_LATEST)
run: pull
@docker run -it $(AWS_ECR_DOMAIN)/$(DOCKER_REPO):$(DOCKER_TAG_LATEST) /bin/sh -c "./exec.sh"