-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
43 lines (37 loc) · 1.24 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
################################################################################
#
# Makefile for ASKCOS
#
################################################################################
.PHONY: build debug push test setup_pages
VERSION ?= latest
GIT_HASH := $(shell git log -1 --format='format:%H')
GIT_DATE := $(shell git log -1 --format='format:%cs')
GIT_DESCRIBE := $(shell git describe --tags --always --dirty)
REGISTRY ?= askcos/askcos-site
TAG ?= $(VERSION)
CORE_VERSION ?= $(VERSION)
main build:
@echo Building docker image: $(REGISTRY):$(TAG)
@sed \
-e 's/{VERSION}/$(VERSION)/g' \
-e 's/{GIT_HASH}/$(GIT_HASH)/g' \
-e 's/{GIT_DATE}/$(GIT_DATE)/g' \
-e 's/{GIT_DESCRIBE}/$(GIT_DESCRIBE)/g' \
Dockerfile | docker build -t $(REGISTRY):$(TAG) \
--build-arg CORE_VERSION=$(CORE_VERSION) \
-f - .
build_ci:
@echo Building docker image: $(REGISTRY):$(TAG)
@sed \
-e 's/{VERSION}/$(VERSION)/g' \
-e 's/{GIT_HASH}/$(GIT_HASH)/g' \
-e 's/{GIT_DATE}/$(GIT_DATE)/g' \
-e 's/{GIT_DESCRIBE}/$(GIT_DESCRIBE)/g' \
Dockerfile | docker build -t $(REGISTRY):$(TAG) \
--cache-from $(REGISTRY):dev \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg CORE_VERSION=$(CORE_VERSION) \
-f - .
push: build_ci
@docker push $(REGISTRY):$(TAG)