-
Notifications
You must be signed in to change notification settings - Fork 46
/
Makefile
75 lines (60 loc) · 2.25 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
# SPDX-License-Identifier: LGPL-3.0-or-later
include Makefile.version
envout:
@echo "VERSION=$(VERSION)"
@echo "UNPACKED_VERSION=$(UNPACKED_VERSION)"
@echo "BUILDARG_VERSION=$(BUILDARG_VERSION)"
@echo "IMAGENAME=$(IMAGENAME)"
@echo "BUILDARG_PLATFORM=$(BUILDARG_PLATFORM)"
prepare:
sudo apt-get -qq -y install curl
build: download
docker buildx build $(BUILDARG_VERSION) $(BUILDARG_PLATFORM) -t $(IMAGENAME):latest .
docker buildx build $(BUILDARG_VERSION) --load -t $(IMAGENAME):latest .
download: LanguageTool-$(VERSION).zip
-rm -rf LanguageTool-$(VERSION) LanguageTool-$(UNPACKED_VERSION)
echo ":: unzipping LanguageTool-$(VERSION).zip"
unzip -o LanguageTool-$(VERSION).zip 2>&1 1>/dev/null
LanguageTool-$(VERSION).zip:
curl -L https://www.languagetool.org/download/LanguageTool-$(VERSION).zip -o LanguageTool-$(VERSION).zip
test: test-cleanup.1
test: test-start
test: TESTIPADDRESS=$(subst ",,$(shell docker inspect languagetool | jq '.[0].NetworkSettings.IPAddress'))
test: test-print-ip-address
test: test-run-test-lang
test: test-run-test-en
test: test-run-test-fr
test: test-cleanup.2
test-start:
docker run -d --name languagetool -p 8010:8010 $(IMAGENAME):latest
sleep 6
test-print-ip-address:
@echo "IP address of languagetools docker container: $(TESTIPADDRESS)"
test-run-test-lang:
curl \
-X GET \
--header 'Accept: application/json' \
'http://$(TESTIPADDRESS):8010/v2/languages'
test-run-test-en:
curl \
-X POST \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
-d 'text=hello%20woorld&language=en-US&motherTongue=de-DE&enabledOnly=false' \
'http://$(TESTIPADDRESS):8010/v2/check'
test-run-test-fr:
curl -X POST \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
-d 'text=hello%20woorld&language=fr&motherTongue=de-DE&enabledOnly=false' \
'http://$(TESTIPADDRESS):8010/v2/check'
.PHONY: test-cleanup
test-cleanup.%:
-docker container stop languagetool
-docker container rm languagetool
.PHONY: tag
tag: tag-push
.PHONY: tag-push
tag-push:
docker buildx build $(BUILDARG_VERSION) $(BUILDARG_PLATFORM) -t $(IMAGENAME):latest . --push
docker buildx build $(BUILDARG_VERSION) $(BUILDARG_PLATFORM) -t $(IMAGENAME):$(VERSION) . --push