forked from opensemanticsearch/open-semantic-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
155 lines (118 loc) · 5.07 KB
/
Dockerfile
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install --no-install-recommends --yes \
apache2 \
libapache2-mod-php \
libapache2-mod-wsgi-py3 \
libjs-jquery \
php \
php-xml \
php-bcmath \
librabbitmq4 \
mkdocs \
python3-django \
python3-pycurl \
python3-rdflib \
python3-sparqlwrapper \
python3-sqlparse \
python3-requests \
python3-pysolr \
python3-dateutil \
python3-lxml \
python3-feedparser \
python3-celery \
python3-pip \
python3-setuptools \
python3-wheel \
python3-dev \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# install django-import-export
RUN pip3 install --no-cache-dir django-import-export && \
pip3 install --no-cache-dir py2neo && \
pip3 install --no-cache-dir warcio
COPY ./src/tika-python/tika /usr/lib/python3/dist-packages/tika
COPY ./src/open-semantic-etl/src /usr/lib/python3/dist-packages/
COPY ./src/open-semantic-etl/src/tesseract-ocr-cache /usr/lib/python3/dist-packages/
COPY ./src/open-semantic-etl/etc /etc/
#
# Include docs
#
COPY ./docs /usr/share/doc/open-semantic-search/docs
COPY mkdocs.yml /usr/share/doc/open-semantic-search/
RUN mkdocs build --config-file /usr/share/doc/open-semantic-search/mkdocs.yml
#
# Include solr-php-ui
#
COPY ./src/solr-php-ui/etc /etc
COPY ./src/solr-php-ui/src /usr/share/solr-php-ui/
# Move config from php directory config to systems config directory /etc
RUN mv ${BUILDDIR}/usr/share/solr-php-ui/config/* /etc/solr-php-ui/
# link from deleted php directory to this new config destination
RUN rmdir /usr/share/solr-php-ui/config
RUN ln -s /etc/solr-php-ui/ /usr/share/solr-php-ui/config
#
# Include Solr Relevance Ranking Analysis Tool
#
COPY ./src/solr-relevance-ranking-analysis/src/solr_relevance_ranking_analysis /var/lib/opensemanticsearch/solr_relevance_ranking_analysis
#
# Include Open Semantic Search Apps
#
COPY ./src/open-semantic-search-apps/src /var/lib/opensemanticsearch/
COPY ./src/open-semantic-search-apps/etc /etc/
#
# Include Open Semantic Entity Search API
#
# include Django app
COPY ./src/open-semantic-entity-search-api/src/entity_rest_api /var/lib/opensemanticsearch/entity_rest_api
# include libraries
COPY ./src/open-semantic-entity-search-api/src/entity_import /usr/lib/python3/dist-packages/entity_import
COPY ./src/open-semantic-entity-search-api/src/entity_linking /usr/lib/python3/dist-packages/entity_linking
COPY ./src/open-semantic-entity-search-api/src/entity_manager /usr/lib/python3/dist-packages/entity_manager
#
# Include Open Semantic Visual Linked Data Explorer
#
COPY ./src/open-semantic-visual-graph-explorer/src /var/lib/opensemanticsearch/
# and its base / dependencies cytoscape.js and cytoscape.js-panzoom
COPY ./src/cytoscape.js/dist /var/lib/opensemanticsearch/visual_graph_explorer/static/
COPY ./src/cytoscape.js-panzoom/cytoscape-panzoom.js /var/lib/opensemanticsearch/visual_graph_explorer/static/
COPY ./src/cytoscape.js-panzoom/cytoscape.js-panzoom.css /var/lib/opensemanticsearch/visual_graph_explorer/static/
COPY ./src/cytoscape.js-panzoom/font-awesome-4.0.3 /var/lib/opensemanticsearch/visual_graph_explorer/static/
#
# Include Solr-Ontology-Tagger
#
COPY ./src/solr-ontology-tagger/src /usr/lib/python3/dist-packages/
# export static files to directory for webserver
RUN python3 /var/lib/opensemanticsearch/manage.py collectstatic --noinput
# Copy ontologies from/to var/opensemanticsearch/media/ontologies (which creates /var/opensemanticsearch/)
COPY ./src/open-semantic-search-apps/var /var/
RUN mkdir /var/opensemanticsearch/db
RUN chown -R www-data:www-data /var/opensemanticsearch
# create or upgrade DB
RUN python3 /var/lib/opensemanticsearch/manage.py migrate
# allow Django running in apache2 context to read and write to DB
RUN chown www-data:www-data /var/opensemanticsearch/db/db.sqlite3
# but others should not be able to read DB entries
RUN chmod o-r /var/opensemanticsearch/db/db.sqlite3
# allow Django running in apache2 context to write facets config
RUN chgrp www-data /etc/opensemanticsearch/facets
RUN chmod g+r /etc/opensemanticsearch/facets
RUN chmod g+w /etc/opensemanticsearch/facets
# allow Django running in apache2 context to write ETL config
RUN chgrp www-data /etc/opensemanticsearch/etl-webadmin
RUN chmod g+r /etc/opensemanticsearch/etl-webadmin
RUN chmod g+w /etc/opensemanticsearch/etl-webadmin
# allow Django running in apache2 context to write UI config
RUN chgrp www-data /etc/solr-php-ui/config.webadmin.php
RUN chmod g+r /etc/solr-php-ui/config.webadmin.php
RUN chmod g+w /etc/solr-php-ui/config.webadmin.php
RUN chgrp www-data /etc/solr-php-ui/config.facets.php
RUN chmod g+r /etc/solr-php-ui/config.facets.php
RUN chmod g+w /etc/solr-php-ui/config.facets.php
# enable apache2 module for Django
RUN a2enmod wsgi
# allow Django running in apache2 context to write OCR dictionary
RUN chown www-data:www-data /etc/opensemanticsearch/ocr/dictionary.txt
RUN chmod o+r /etc/opensemanticsearch/ocr/dictionary.txt
COPY ./docker-entrypoint.sh /
RUN chmod 755 /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]