Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.

支持Docker Image构建特性, 提供可运行的Dockerfile #31

Open
wants to merge 3 commits into
base: 1.7.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
.*
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
20 changes: 20 additions & 0 deletions bin/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
4 changes: 4 additions & 0 deletions config/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"