diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3ec1231 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +.* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..782688e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM java:7-jre +ENV ES_HOME=/usr/share/elasticsearch-rtf +ENV PATH $ES_HOME/bin:$PATH + +# RUN git clone -b 1.7.1 git://github.com/medcl/elasticsearch-rtf.git $ES_HOME +COPY . $ES_HOME +COPY bin/docker-entrypoint.sh / + +RUN $ES_HOME/bin/plugin -install mobz/elasticsearch-head + +RUN $ES_HOME/bin/plugin -install river-csv -url https://github.com/AgileWorksOrg/elasticsearch-river-csv/releases/download/2.2.1/elasticsearch-river-csv-2.2.1.zip + +# ES_MAX_MEM, ES_MIN_MEM or ES_HEAP_SIZE only (max = min) +# RUN git clone https://github.com/elastic/elasticsearch-servicewrapper /usr/share/elasticsearch-servicewrapper +# RUN cp -r /user/share/elasticsearch-servicewrapper/service $ES_HOME/bin/ +# RUN /user/share/elasticsearch-servicewrapper/elasticsearch64 install +# RUN service elasticsearch start + +RUN mkdir -p $ES_HOME/data +RUN mkdir -p $ES_HOME/data-csv + +# VOLUME /usr/share/elasticsearch-rtf/data + +VOLUME ["/usr/share/elasticsearch-rtf/data", "/usr/share/elasticsearch-rtf/data-csv"] + + +ENTRYPOINT ["/docker-entrypoint.sh"] + +EXPOSE 9200 9300 + +CMD ["elasticsearch"] diff --git a/bin/docker-entrypoint.sh b/bin/docker-entrypoint.sh new file mode 100755 index 0000000..0910fcb --- /dev/null +++ b/bin/docker-entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +# Add elasticsearch as command if it is needed +if [ "${1:0:1}" = '-' ]; then + set -- elasticsearch "$@" +fi + +# Drop root privileges if we are running elasticsearch +#if [ "$1" = 'elasticsearch' ]; then + # Change the ownership of /usr/share/elasticsearch/data to elasticsearch +# chown -R elasticsearch:elasticsearch /usr/share/elasticsearch-rtf/data +# exec gosu elasticsearch "$@" +#fi + +# As argument is not related to elasticsearch, +# then assume that user wants to run his own process, +# for example a `bash` shell to explore this image +exec "$@" diff --git a/config/elasticsearch.yml b/config/elasticsearch.yml index a3bfd63..47a9da5 100755 --- a/config/elasticsearch.yml +++ b/config/elasticsearch.yml @@ -434,3 +434,7 @@ index: tokenizer: mmseg_complex index.analysis.analyzer.default.type : "org.elasticsearch.index.analysis.MMsegAnalyzerProvider" script.groovy.sandbox.enabled: true +http.cors.enabled : true +http.cors.allow-origin: "/.*/" +http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE +http.cors.allow-headers : "X-Requested-With,X-Auth-Token,Content-Type, Content-Length, Authorization"