-
Notifications
You must be signed in to change notification settings - Fork 48
/
Dockerfile
91 lines (81 loc) · 3.1 KB
/
Dockerfile
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
FROM openjdk:8-jre
MAINTAINER Guillaume Simonneau <[email protected]>
LABEL Description="elasticsearch searchguard search-guard"
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.10
RUN set -x \
&& wget -O /usr/local/bin/gosu "https:/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https:/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true
RUN set -ex; \
# https://artifacts.elastic.co/GPG-KEY-elasticsearch
key='46095ACC8548582C1A2699A9D27D666CD88E42B4'; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
gpg --export "$key" > /etc/apt/trusted.gpg.d/elastic.gpg; \
rm -rf "$GNUPGHOME"; \
apt-key list
# https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
# https://www.elastic.co/guide/en/elasticsearch/reference/5.0/deb.html
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends apt-transport-https && rm -rf /var/lib/apt/lists/* \
&& echo 'deb https://artifacts.elastic.co/packages/5.x/apt stable main' > /etc/apt/sources.list.d/elasticsearch.list
ENV ELASTICSEARCH_VERSION 5.6.3
ENV ELASTICSEARCH_DEB_VERSION 5.6.3
RUN set -x \
# don't allow the package to install its sysctl file (causes the install to fail)
# Failed to write '262144' to '/proc/sys/vm/max_map_count': Read-only file system
&& dpkg-divert --rename /usr/lib/sysctl.d/elasticsearch.conf \
&& apt-get update \
&& apt-get install -y --no-install-recommends "elasticsearch=$ELASTICSEARCH_DEB_VERSION" \
&& rm -rf /var/lib/apt/lists/*
ENV PATH /usr/share/elasticsearch/bin:$PATH
WORKDIR /usr/share/elasticsearch
# Plugins
RUN bin/elasticsearch-plugin install -b "com.floragunn:search-guard-5:$ELASTICSEARCH_VERSION-16"
RUN mkdir -p /.backup/elasticsearch/
RUN set -ex \
&& for path in \
./data \
./logs \
./config \
./config/scripts \
; do \
mkdir -p "$path"; \
chown -R elasticsearch:elasticsearch "$path"; \
done
COPY config /.backup/elasticsearch/config
VOLUME /usr/share/elasticsearch/config
VOLUME /usr/share/elasticsearch/data
EXPOSE 9200 9300
# env
ENV CLUSTER_NAME="elasticsearch-default" \
MINIMUM_MASTER_NODES=1 \
HOSTS="127.0.0.1, [::1]" \
NODE_NAME=NODE-1 \
NODE_MASTER=true \
NODE_DATA=true \
NODE_INGEST=true \
HTTP_ENABLE=true \
HTTP_CORS_ENABLE=true \
HTTP_CORS_ALLOW_ORIGIN=* \
NETWORK_HOST="0.0.0.0" \
ELASTIC_PWD="changeme" \
KIBANA_PWD="changeme" \
LOGSTASH_PWD="changeme" \
BEATS_PWD="changeme" \
HEAP_SIZE="1g" \
CA_PWD="changeme" \
TS_PWD="changeme" \
KS_PWD="changeme" \
HTTP_SSL=true \
LOG_LEVEL=INFO
COPY ./src/ /run/
RUN chmod +x -R /run/
ENTRYPOINT ["/run/entrypoint.sh"]
CMD ["elasticsearch"]