forked from Chaste/chaste-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
123 lines (103 loc) · 3.5 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
help:
@cat Makefile
CHASTE_IMAGE?=chaste/release
BASE?=focal
TAG?=2021.1
GIT_TAG?="${TAG}"
# GIT_TAG?=$(git describe --abbrev=0)
CHASTE_DIR?="/home/chaste"
DOCKER_FILE?=Dockerfile
CHASTE_DATA_VOLUME?=chaste_data
CMAKE_BUILD_TYPE?="Release"
Chaste_ERROR_ON_WARNING?="OFF"
Chaste_UPDATE_PROVENANCE?="OFF"
# PROJECTS?="${HOME}/projects"
# TEST_OUTPUT?="${HOME}/testoutput"
TEST_SUITE?="Continuous"
# SRC?=$(shell dirname `pwd`)
all: base release
.PHONY: all build base release fresh latest master develop clean stats pull push run test info verbose
# BUILD_ARGS := --build-arg BASE=$(BASE)
# IMAGE_NAMES := -t $(CHASTE_IMAGE):$(TAG)
# base release: TARGET = $@
# release: BUILD_ARGS += --build-arg CHASTE_DIR=$(CHASTE_DIR) --build-arg TAG=$(GIT_TAG)
# release: IMAGE_NAMES += -t $(CHASTE_IMAGE):$(BASE)-$(TAG)
# base: BUILD_ARGS += --target $@
# base: CHASTE_IMAGE = chaste/base
# base: IMAGE_NAMES = $(CHASTE_IMAGE):$(BASE)
# base release: build
# for NAME in $(IMAGE_NAMES) ; do \
# push $$(NAME) ; \
# done
# build:
# docker build $(BUILD_ARGS) $(IMAGE_NAMES) -f $(DOCKER_FILE) .
# # docker push $(IMAGE_NAMES)
TARGET?=
#stub: TARGET = --target base
# Do not declare volume for base (or stub - deprecated) so that subsequent layers may modify the contents of /home/chaste
# NOTE: When a container is started which creates a new volume, the contents of the mount point is copied to the volume
base stub: TARGET = --target base
base stub:
docker build -t chaste/$@:$(BASE) \
--build-arg BASE=$(BASE) \
--build-arg CHASTE_DIR=$(CHASTE_DIR) \
$(TARGET) \
-f $(DOCKER_FILE) .
docker push chaste/$@:$(BASE)
EXTRA_ARGS?=
build:
docker build -t $(CHASTE_IMAGE):$(TAG) \
-t $(CHASTE_IMAGE):$(BASE)-$(TAG) \
--build-arg BASE=$(BASE) \
--build-arg CHASTE_DIR=$(CHASTE_DIR) \
--build-arg TAG=$(GIT_TAG) \
--build-arg CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
--build-arg Chaste_ERROR_ON_WARNING=$(Chaste_ERROR_ON_WARNING) \
--build-arg Chaste_UPDATE_PROVENANCE=$(Chaste_UPDATE_PROVENANCE) \
-f $(DOCKER_FILE) $(EXTRA_ARGS) .
fresh latest: EXTRA_ARGS += --no-cache
latest: GIT_TAG=master
fresh latest: build
#develop: CHASTE_IMAGE=chaste/develop
# docker build -t $(CHASTE_IMAGE):$@ \
master develop: CMAKE_BUILD_TYPE="Debug" Chaste_ERROR_ON_WARNING="ON" Chaste_UPDATE_PROVENANCE="OFF"
master develop:
docker build -t chaste/$@ \
--build-arg BASE=$(BASE) \
--build-arg CHASTE_DIR=$(CHASTE_DIR) \
--build-arg TAG=$@ \
--build-arg CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
--build-arg Chaste_ERROR_ON_WARNING=$(Chaste_ERROR_ON_WARNING) \
--build-arg Chaste_UPDATE_PROVENANCE=$(Chaste_UPDATE_PROVENANCE) \
-f $(DOCKER_FILE) .
clean:
docker system prune
stats:
docker stats
pull:
docker pull $(CHASTE_IMAGE):$(TAG)
push:
docker push $(CHASTE_IMAGE):$(TAG)
docker push $(CHASTE_IMAGE):$(BASE)-$(TAG)
MOUNTS = -v $(CHASTE_DATA_VOLUME):$(CHASTE_DIR)
ifdef PROJECTS
MOUNTS += -v $(PROJECTS):$(CHASTE_DIR)/projects
endif
ifdef TEST_OUTPUT
MOUNTS += -v $(TEST_OUTPUT):$(CHASTE_DIR)/testoutput
endif
run: build
docker run -it --init --rm $(MOUNTS) $(CHASTE_IMAGE):$(TAG)
test: build
docker run -it --init --rm --env CMAKE_BUILD_TYPE=Debug \
$(CHASTE_IMAGE):$(TAG) test.sh $(TEST_SUITE)
release: CHASTE_IMAGE=chaste/release
release: build test push
build-info: TEST_SUITE=TestChasteBuildInfo
build-info: test
info:
@echo "Mounts: $(MOUNTS)"
lsb_release -a
docker -v
verbose: info
docker system info