-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
52 lines (36 loc) · 1.4 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
50
51
52
SHELL = /bin/bash
project_root = $(realpath ..)
project_name = $(notdir $(realpath .))
project_version = $(shell cat VERSION)
# We use this makefile from tests
makefile_dir := $(dir $(lastword $(MAKEFILE_LIST)))
include $(makefile_dir)util/make/makefile.base.mk
include $(makefile_dir)util/make/makefile.git.mk
mirror := mirror
mirror_lock := requirements.lock
artifacts := leolani
.DEFAULT_GOAL := build
.PHONY: clean
clean:
$(info Clean $(project_name))
@rm -rf $(mirror) $(mirror_lock) $(artifacts) docker.lock docker.mirror.lock
@mkdir $(mirror) $(artifacts)
$(mirror_lock): requirements.txt
$(info Download to mirror: $(shell python --version))
@pip install --upgrade pip; \
pip install wheel; \
pip download --requirement requirements.txt -d mirror \
| tee $(shell tty) | grep Collecting | cut -f 2 -d ' ' > $(mirror_lock)
.PHONY:
build: $(mirror_lock) $(artifacts)
$(artifacts):
@mkdir -p $(artifacts)
install: docker
.PHONY: docker
docker: docker.lock
docker.mirror.lock: $(mirror_lock)
DOCKER_BUILDKIT=1 docker build -t cltl/${project_name}-mirror:${project_version} -f Dockerfile.mirror .
@echo "${project_version}" > docker.mirror.lock
docker.lock: docker.mirror.lock $(artifacts) $(wildcard $(artifacts)/*)
DOCKER_BUILDKIT=1 docker build -t cltl/${project_name}:${project_version} --build-arg image=${project_name}-mirror --build-arg version=$(shell cat docker.mirror.lock) .
@touch docker.lock