forked from mjanez/ckan-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.spatial
76 lines (57 loc) · 4.18 KB
/
Dockerfile.spatial
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
FROM solr:9
ENV SOLR_PORT=8983
EXPOSE ${SOLR_PORT}
ARG CKAN_BRANCH="dev-v2.10"
ENV SOLR_INSTALL="/opt/solr"
ENV SOLR_CONFIG_DIR="$SOLR_INSTALL/server/solr/configsets"
ENV SOLR_SCHEMA_FILE="$SOLR_CONFIG_DIR/ckan/conf/managed-schema"
ARG JTS_VERSION="1.19.0"
ARG JTS_JAR_FILE="$SOLR_INSTALL/server/solr-webapp/webapp/WEB-INF/lib/jts-core-$JTS_VERSION.jar"
USER root
# Create a CKAN configset by copying the default one
RUN cp -R $SOLR_CONFIG_DIR/_default $SOLR_CONFIG_DIR/ckan
# Update the schema
ADD https://raw.githubusercontent.com/ckan/ckan/$CKAN_BRANCH/ckan/config/solr/schema.xml $SOLR_SCHEMA_FILE
# Install JTS JAR file
ADD https://repo1.maven.org/maven2/org/locationtech/jts/jts-core/$JTS_VERSION/jts-core-$JTS_VERSION.jar \
$JTS_JAR_FILE
RUN chmod 644 $JTS_JAR_FILE
# Add the spatial field type definitions and fields
## RPT
ENV SOLR_RPT_FIELD_DEFINITION '<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType" \
spatialContextFactory="JTS" \
autoIndex="true" \
validationRule="repairBuffer0" \
distErrPct="0.025" \
maxDistErr="0.001" \
distanceUnits="kilometers" />'
ENV SOLR_RPT_FIELD '<field name="spatial_geom" type="location_rpt" indexed="true" multiValued="true" />'
RUN sed -i "/<types>/a $SOLR_RPT_FIELD_DEFINITION" $SOLR_SCHEMA_FILE
RUN sed -i "/<fields>/a $SOLR_RPT_FIELD" $SOLR_SCHEMA_FILE
## BBox
ENV SOLR_BBOX_FIELDS '<field name="bbox_area" type="float" indexed="true" stored="true" /> \
<field name="maxx" type="float" indexed="true" stored="true" /> \
<field name="maxy" type="float" indexed="true" stored="true" /> \
<field name="minx" type="float" indexed="true" stored="true" /> \
<field name="miny" type="float" indexed="true" stored="true" /> \
<field name="tag_uri" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="conforms_to" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="applicable_legislation" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="lineage_source" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="lineage_process_steps" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="reference" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="is_referenced_by" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="theme" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="theme_es" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="theme_eu" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="hvd_category" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="language" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="resource_relation" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="documentation" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="metadata_profile" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/>' \
'<field name="dcat_type" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/>' \
'<field name="dataset_scope" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/>'
RUN sed -i "/<fields>/a $SOLR_BBOX_FIELDS" $SOLR_SCHEMA_FILE
RUN chmod 644 $SOLR_SCHEMA_FILE
USER solr
CMD ["sh", "-c", "solr-precreate ckan $SOLR_CONFIG_DIR/ckan"]