forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 28
/
build-test-semantic-search.xml
62 lines (47 loc) · 2.31 KB
/
build-test-semantic-search.xml
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
<?xml version="1.0"?>
<project basedir="." name="portal-test-semantic-search" xmlns:antelope="antlib:ise.antelope.tasks" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="build-test.xml" />
<condition else="liferay" property="container.prefix" value="${env.HOSTNAME}">
<isset property="env.JENKINS_HOME" />
</condition>
<macrodef name="build-txtai-docker-image">
<sequential>
<echo file="${project.dir}/txtai/config.yml">embeddings:
path: sentence-transformers/msmarco-distilbert-base-dot-prod-v3
path: /tmp/index
writable: False</echo>
<echo file="${project.dir}/txtai/Dockerfile">FROM neuml/txtai-cpu:5.1.0
COPY config.yml .
ENV CONFIG "config.yml"
ENTRYPOINT ["uvicorn", "--host", "0.0.0.0", "txtai.api:app"]
RUN python -c "from txtai.api import API; API('config.yml', False)"</echo>
<execute dir="${project.dir}/txtai">
<![CDATA[
docker build -t txtai-api .
]]>
</execute>
<delete dir="${project.dir}/txtai" />
</sequential>
</macrodef>
<macrodef name="configure-portal-txtai-osgi-properties">
<sequential>
<exec executable="/bin/bash" outputproperty="txtai.container.ip">
<arg value="-c" />
<arg value="docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${container.prefix}_txtai" />
</exec>
<echo file="${liferay.home}/osgi/configs/com.liferay.portal.search.configuration.SemanticSearchConfiguration.config">textEmbeddingCacheTimeout="604800"
textEmbeddingProviderConfigurationJSONs=["\{\"attributes\": \{\"hostAddress\": \"http://${txtai.container.ip}:8000\", \"maxCharacterCount\": 500\}, \"embeddingVectorDimensions\": 768, \"languageIds\": [\"en_US\"], \"modelClassNames\": [\"com.liferay.blogs.model.BlogsEntry\", \"com.liferay.journal.model.JournalArticle\", \"com.liferay.knowledge.base.model.KBArticle\", \"com.liferay.message.boards.model.MBMessage\", \"com.liferay.wiki.model.WikiPage\"], \"providerName\": \"txtai\"\}"]
textEmbeddingsEnabled="true"</echo>
</sequential>
</macrodef>
<target name="set-up-txtai">
<build-txtai-docker-image />
<start-docker-container image="txtai-api" name="${container.prefix}_txtai">\
-p 8000:8000 \
</start-docker-container>
<configure-portal-txtai-osgi-properties />
</target>
<target name="stop-txtai">
<stop-docker-container name="${container.prefix}_txtai" />
</target>
</project>