-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
59 lines (45 loc) · 1.49 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
.PHONY: init test clean container_build container_clean
bw_version = "bw-linux-2023.2.0.zip"
bw_release = "cli-v2023.2.0"
dockerfile = "Dockerfile"
image_version = "latest"
container_name = "otterdog"
POETRY := $(shell command -v poetry 2> /dev/null)
OTTERDOG_SCRIPT := $(realpath ./otterdog.sh)
OTTERDOG_LINK := ~/.local/bin/otterdog
init:
ifndef POETRY
pip3 install "poetry==1.4.2"
endif
poetry config virtualenvs.in-project true
poetry install --only=main
poetry run playwright install firefox
test -f $(OTTERDOG_LINK) || ln -s $(OTTERDOG_SCRIPT) $(OTTERDOG_LINK)
test:
poetry run py.test
clean:
rm -rf .venv
rm -rf dist
rm -rf .pytest_cache
find -iname "*.pyc" -delete
container_build:
$(call CONTAINER_BUILDER,$(image_version))
container_build_dev:
echo "Freezing $(dockerfile) and commenting ENTRYPOINT line"
git update-index --assume-unchanged $(dockerfile)
sed -i '/^ENTRYPOINT/ s/./#&/' Dockerfile
$(call CONTAINER_BUILDER,"dev")
echo "Unfreezing $(dockerfile) and commenting ENTRYPOINT line"
sed -i '/^#ENTRYPOINT/ s/#//' Dockerfile
git update-index --no-assume-unchanged Dockerfile
container_clean:
$(call CONTAINER_CLEANER,$(image_version))
container_clean_dev:
$(call CONTAINER_CLEANER,"dev")
define CONTAINER_BUILDER
docker build --no-cache --build-arg BW_VERSION=$(bw_version) --build-arg BW_RELEASE=$(bw_release) -t eclipse/otterdog:$(1) -f $(dockerfile) .
endef
define CONTAINER_CLEANER
docker rm -f $(container_name)
docker rmi -f eclipse/$(container_name):$(1)
endef