Skip to content

Commit dd06266

Browse files
committed
first commit
0 parents  commit dd06266

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

Dockerfile

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
FROM maven:3.3.9-jdk-8
2+
3+
MAINTAINER B1nj0y <idegorepl@gmail.com>
4+
5+
# grab gosu for easy step-down from root
6+
ENV GOSU_VERSION 1.7
7+
RUN set -x \
8+
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
9+
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
10+
&& export GNUPGHOME="$(mktemp -d)" \
11+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
12+
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
13+
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
14+
&& chmod +x /usr/local/bin/gosu \
15+
&& gosu nobody true
16+
17+
RUN set -ex; \
18+
# https://artifacts.elastic.co/GPG-KEY-elasticsearch
19+
key='46095ACC8548582C1A2699A9D27D666CD88E42B4'; \
20+
export GNUPGHOME="$(mktemp -d)"; \
21+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
22+
gpg --export "$key" > /etc/apt/trusted.gpg.d/elastic.gpg; \
23+
rm -r "$GNUPGHOME"; \
24+
apt-key list
25+
26+
# https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
27+
# https://www.elastic.co/guide/en/elasticsearch/reference/5.0/deb.html
28+
RUN set -x \
29+
&& apt-get update && apt-get install -y --no-install-recommends apt-transport-https && rm -rf /var/lib/apt/lists/* \
30+
&& echo 'deb https://artifacts.elastic.co/packages/5.x/apt stable main' > /etc/apt/sources.list.d/elasticsearch.list
31+
32+
ENV ELASTICSEARCH_VERSION 5.3.0
33+
ENV ELASTICSEARCH_DEB_VERSION 5.3.0
34+
35+
RUN set -x \
36+
\
37+
# don't allow the package to install its sysctl file (causes the install to fail)
38+
# Failed to write '262144' to '/proc/sys/vm/max_map_count': Read-only file system
39+
&& dpkg-divert --rename /usr/lib/sysctl.d/elasticsearch.conf \
40+
\
41+
&& apt-get update \
42+
&& apt-get install -y git \
43+
&& apt-get install -y --no-install-recommends "elasticsearch=$ELASTICSEARCH_DEB_VERSION" \
44+
&& rm -rf /var/lib/apt/lists/*
45+
46+
RUN set -x \
47+
&& cd /usr/share/elasticsearch \
48+
&& git clone https://github.com/medcl/elasticsearch-analysis-ik \
49+
&& cd elasticsearch-analysis-ik \
50+
&& mvn clean \
51+
&& mvn compile \
52+
&& mvn package \
53+
&& cd /usr/share/elasticsearch \
54+
&& unzip elasticsearch-analysis-ik/target/releases/elasticsearch-analysis-ik-5.3.0.zip -d plugins/ik \
55+
&& rm -rf elasticsearch-analysis-ik
56+
57+
ENV PATH /usr/share/elasticsearch/bin:$PATH
58+
59+
WORKDIR /usr/share/elasticsearch
60+
61+
RUN set -ex \
62+
&& for path in \
63+
./data \
64+
./logs \
65+
./config \
66+
./config/scripts \
67+
; do \
68+
mkdir -p "$path"; \
69+
chown -R elasticsearch:elasticsearch "$path"; \
70+
done
71+
72+
COPY config ./config
73+
74+
VOLUME /usr/share/elasticsearch/data
75+
76+
COPY docker-entrypoint.sh /
77+
78+
EXPOSE 9200 9300
79+
ENTRYPOINT ["/docker-entrypoint.sh"]
80+
CMD ["elasticsearch"]

config/elasticsearch.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
http.host: 0.0.0.0
2+
3+
# Uncomment the following lines for a production cluster deployment
4+
#transport.host: 0.0.0.0
5+
#discovery.zen.minimum_master_nodes: 1

config/log4j2.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
status = error
2+
3+
appender.console.type = Console
4+
appender.console.name = console
5+
appender.console.layout.type = PatternLayout
6+
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
7+
8+
rootLogger.level = info
9+
rootLogger.appenderRef.console.ref = console

docker-entrypoint.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Add elasticsearch as command if needed
6+
if [ "${1:0:1}" = '-' ]; then
7+
set -- elasticsearch "$@"
8+
fi
9+
10+
# Drop root privileges if we are running elasticsearch
11+
# allow the container to be started with `--user`
12+
if [ "$1" = 'elasticsearch' -a "$(id -u)" = '0' ]; then
13+
# Change the ownership of user-mutable directories to elasticsearch
14+
for path in \
15+
/usr/share/elasticsearch/data \
16+
/usr/share/elasticsearch/logs \
17+
; do
18+
chown -R elasticsearch:elasticsearch "$path"
19+
done
20+
21+
set -- gosu elasticsearch "$@"
22+
#exec gosu elasticsearch "$BASH_SOURCE" "$@"
23+
fi
24+
25+
# As argument is not related to elasticsearch,
26+
# then assume that user wants to run his own process,
27+
# for example a `bash` shell to explore this image
28+
exec "$@"

0 commit comments

Comments
 (0)