forked from silvio/docker-languagetool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (52 loc) · 1.8 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
include Makefile.version
envout:
@echo "VERSION=$(VERSION)"
@echo "BUILDARG_VERSION=$(BUILDARG_VERSION)"
@echo "IMAGENAME=$(IMAGENAME)"
@echo "BUILDARG_PLATFORM=$(BUILDARG_PLATFORM)"
prepare:
sudo apt-get -qq -y install curl
build:
docker buildx build $(BUILDARG_VERSION) $(BUILDARG_PLATFORM) -t $(IMAGENAME):latest .
docker buildx build $(BUILDARG_VERSION) --load -t $(IMAGENAME):latest .
test: test-cleanup.1
test: TESTIPADDRESS=$(subst ",,$(shell docker inspect languagetool | jq '.[0].NetworkSettings.IPAddress'))
test: test-print-ip-address
test: test-start
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 3
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 stop languagetool
-docker 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