-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f4c856
commit 57596f6
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# A few useful Docker commands to build an image on Apple Sillicon (ARM64) and run the Solr container. | ||
# | ||
# Build (run with '--no-cache' to ensure that Git repo new tags will be pulled down, as Docker caches RUN layers): | ||
# docker build -t solr-sudachi -f Dockerfile.arm64 . --no-cache --platform linux/arm64 | ||
# | ||
# Run: | ||
# docker run -p 8983:8983 --rm solr-sudachi:latest solr-precreate example | ||
# | ||
# cURL requests: | ||
# 1. curl -sS 'http://localhost:8983/solr/example/analysis/field?analysis.fieldtype=text_ja' --get --data-urlencode 'analysis.fieldvalue=ちいかわ' | jq '.analysis.field_types.text_ja.index[1][].text' | ||
# 2. curl -sS 'http://localhost:8983/solr/example/analysis/field?analysis.fieldtype=text_ja' --get --data-urlencode 'analysis.fieldvalue=すもももももももものうち' | jq '.analysis.field_types.text_ja.index[1][].text' | ||
# 3. curl -sS 'http://localhost:8983/solr/example/analysis/field?analysis.fieldtype=text_ja' --get --data-urlencode 'analysis.fieldvalue=聖川真斗' | jq '.analysis.field_types.text_ja.index[1][].text' | ||
# | ||
# See: https://github.com/apache/lucene/pull/12517 | ||
# | ||
|
||
######################################################################################## | ||
# Stage 1 : Solr Lucene Analyzer Sudachi JAR | ||
######################################################################################## | ||
FROM gradle:8.1.1-jdk11@sha256:085ef38a5cc3c2d0f65fbe15fcf75164ef4e610ffba0bb66c3ba9bbdb72e30b2 AS BUILD_JAR_STAGE | ||
|
||
ARG PLUGIN_GIT_TAG=9.4.1 | ||
|
||
ENV GRADLE_USER_HOME=/home/gradle | ||
WORKDIR $GRADLE_USER_HOME | ||
|
||
RUN git clone -b v$PLUGIN_GIT_TAG https://github.com/azagniotov/solr-lucene-analyzer-sudachi.git --depth 1 && \ | ||
git config --global user.name "Alexander Zagniotov" && \ | ||
git config --global user.email "[email protected]" | ||
|
||
# Download the dictionary and assemble the JAR to be placed under Solr /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/ | ||
RUN cd solr-lucene-analyzer-sudachi && \ | ||
gradle configureDictionariesLocally && \ | ||
gradle -PsolrVersion=$PLUGIN_GIT_TAG assemble && \ | ||
ls -al ./build/libs/ | ||
|
||
|
||
######################################################################################## | ||
# Stage 2 : Run Solr | ||
######################################################################################## | ||
FROM solr:9.4.1@sha256:68dd584e8e890fa2c2115966a669743b8f5918475e72551ccaecfa6236afcc8b | ||
|
||
MAINTAINER Alexander Zagniotov <[email protected]> | ||
|
||
ENV SOLR_JAVA_MEM="-Xms4g -Xmx4g" | ||
ENV SOLR_OPT_DIR=/opt/solr | ||
ENV SOLR_SERVER_HOME=$SOLR_OPT_DIR/server | ||
ENV SUDACHI_DICT_HOME=/tmp/sudachi | ||
ENV SOLR_WEB_INF_LIB_HOME=$SOLR_SERVER_HOME/solr-webapp/webapp/WEB-INF/lib | ||
|
||
ENV SUDACHI_SYSTEM_DICT=$SOLR_OPT_DIR/system.dict | ||
ENV SUDACHI_USER_DICT=$SOLR_OPT_DIR/user_lexicon.dict | ||
|
||
USER root | ||
|
||
# Copy dictionaries to /opt/solr | ||
# See https://github.com/apache/solr-docker/blob/7e3be2fce98be1fe9c80be0727b4600d4b52fd0f/9.3/Dockerfile#L129 | ||
COPY --from=BUILD_JAR_STAGE $SUDACHI_DICT_HOME/system-dict/system.dict $SOLR_OPT_DIR/system.dict | ||
COPY --from=BUILD_JAR_STAGE $SUDACHI_DICT_HOME/user_lexicon.dict $SOLR_OPT_DIR/user_lexicon.dict | ||
COPY --from=BUILD_JAR_STAGE /home/gradle/solr-lucene-analyzer-sudachi/build/libs/solr-lucene-analyzer-sudachi*.jar $SOLR_WEB_INF_LIB_HOME/ | ||
COPY schema.xml $SOLR_SERVER_HOME/solr/configsets/_default/conf/managed-schema.xml | ||
|
||
USER solr |