-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (59 loc) · 2.18 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
SHELL = /bin/bash
APP_NAME := code-indexer
REPOSITORY := dynofu/code-indexer
VERSION_TAG := 2019.11.11
IMAGE := $(REPOSITORY):$(VERSION_TAG)
CONTAINER := $(APP_NAME)
$(info REPOSITORY=$(REPOSITORY) VERSION_TAG=$(VERSION_TAG) IMAGE=$(IMAGE) CONTAINER=$(CONTAINER))
.DEFAULT_GOAL := docker-build
# ------------------------------------------------------------------------------
# ## Build and Release ##
# https://github.com/oracle/opengrok/releases
OPENGROK_RELEASE := 1.3.3
build-opengrok:
mkdir -p tmp
[[ -e tmp/opengrok ]] || (cd tmp && git clone https://github.com/oracle/opengrok.git)
cd tmp/opengrok; \
git show-ref --verify --quiet refs/heads/r$(OPENGROK_RELEASE) \
|| (git fetch --tags --force \
&& git checkout $(OPENGROK_RELEASE) -b r$(OPENGROK_RELEASE) --force) \
# END
@# https://github.com/oracle/opengrok/blob/master/docker/README.md#build-image-locally
cd tmp/opengrok && ./mvnw -DskipTests=true clean package
docker-build:
docker build . \
--build-arg OPENGROK_RELEASE=$(OPENGROK_RELEASE) \
--tag $(REPOSITORY):$(VERSION_TAG) \
--tag $(REPOSITORY):latest \
# END
docker-push:
docker push $(REPOSITORY):$(VERSION_TAG)
docker push $(REPOSITORY):latest
# ------------------------------------------------------------------------------
# ## Test and Run ##
docker-start: docker-run
CMD :=
OPT :=
ifneq ($(wildcard scripts/repos.jsonnet),)
REPOS_MAPPING := -v $${PWD}/scripts/repos.jsonnet:/scripts/repositories.jsonnet
else
REPOS_MAPPING :=
endif
docker-run:
docker rm $(CONTAINER) || true
mkdir -p tmp
mkdir -p src
docker run --rm $(OPT) --name $(CONTAINER) \
-p 8129:8129 \
$(REPOS_MAPPING) \
-v $${PWD}/tmp:/tmp \
-v $${PWD}/src:/src \
$(IMAGE) \
$(CMD) \
# END
docker-bash:
$(MAKE) docker-exec CMD=/bin/bash
docker-exec:
docker exec -it $(CONTAINER) $(CMD)
docker-stop:
docker stop $(CONTAINER)