-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
29 lines (23 loc) · 1.04 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
SHELL := /bin/bash
.DEFAULT_GOAL := help
# Configure the Docker commands
DOCKER_EXEC:=docker
# Use for docker image build
GIT_VERSION = $(shell git describe --abbrev=0 --tags)
BUILD_DATE=$(shell date --rfc-3339=seconds)
GIT_COMMIT=$(shell git rev-parse HEAD)
DOCKER_REGISTRY=gcr.io/lumapps-registry
DOCKER_IMAGE_CANONICAL=$(DOCKER_REGISTRY)/design-system:$(GIT_COMMIT)
DOCKER_IMAGE_HUMAN_READABLE=$(DOCKER_REGISTRY)/design-system:$(GIT_VERSION)
DOCKER_LABELS= --label="com.lumapps.image.created=$(BUILD_DATE)" \
--label=com.lumapps.image.sha1=$(GIT_SHA1) \
--label=com.lumapps.image.version=$(GIT_VERSION) \
docker_build:
$(DOCKER_EXEC) build $(DOCKER_LABELS) -t $(DOCKER_IMAGE_CANONICAL) -t ${DOCKER_IMAGE_HUMAN_READABLE} .
docker_push:
$(DOCKER_EXEC) push $(DOCKER_IMAGE_CANONICAL)
$(DOCKER_EXEC) push $(DOCKER_IMAGE_HUMAN_READABLE)
# autodocument makefiles
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'