-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (21 loc) · 819 Bytes
/
Copy pathMakefile
File metadata and controls
29 lines (21 loc) · 819 Bytes
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
CONFIG_FILE ?= make.env
REGISTRY ?=
IMAGE_NAME ?= coinbase-local
TAG ?=
PLATFORM ?= linux/amd64
ifneq ("$(wildcard $(CONFIG_FILE))","")
include $(CONFIG_FILE)
endif
GIT_SHA := $(shell git rev-parse --short HEAD 2>/dev/null)
IMAGE_TAG := $(if $(TAG),$(TAG),$(if $(GIT_SHA),$(GIT_SHA),latest))
IMAGE_REPO := $(if $(REGISTRY),$(REGISTRY)/,)$(IMAGE_NAME)
IMAGE := $(IMAGE_REPO):$(IMAGE_TAG)
.PHONY: build push image-name help
build: ## Build the application image
docker build --platform $(PLATFORM) -t $(IMAGE) .
push: build ## Push the application image
docker push $(IMAGE)
image-name: ## Print the image reference that will be used
@echo $(IMAGE)
help: ## Show available make targets
@grep -E '^[a-zA-Z_-]+:.*?## .+' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-12s %s\n", $$1, $$2}'