This repository has been archived by the owner on Apr 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 241
/
Dockerfile.j2
61 lines (47 loc) · 2.35 KB
/
Dockerfile.j2
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
# This Dockerfile was generated from templates/Dockerfile.j2
{% set plugin_list = 'x-pack ingest-user-agent ingest-geoip' %}
{% if staging_build_num -%}
{% set version_tag = elastic_version + '-' + staging_build_num -%}
{% set url_root = 'http://staging.elastic.co/%s/downloads/elasticsearch' % version_tag -%}
{% else -%}
{% set version_tag = elastic_version -%}
{% set url_root = 'https://artifacts.elastic.co/downloads/elasticsearch' -%}
{% endif -%}
{% set tarball = 'elasticsearch-%s.tar.gz' % elastic_version -%}
FROM centos:7
LABEL maintainer "Elastic Docker Team <docker@elastic.co>"
ENV ELASTIC_CONTAINER true
ENV PATH /usr/share/elasticsearch/bin:$PATH
ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk
RUN yum update -y && yum install -y java-1.8.0-openjdk-headless wget which && yum clean all
RUN groupadd -g 1000 elasticsearch && adduser -u 1000 -g 1000 -d /usr/share/elasticsearch elasticsearch
WORKDIR /usr/share/elasticsearch
# Download/extract defined ES version. busybox tar can't strip leading dir.
RUN wget --progress=bar:force {{ url_root }}/{{ tarball }} && \
EXPECTED_SHA=$(wget -O - {{ url_root }}/{{ tarball }}.sha1) && \
test $EXPECTED_SHA == $(sha1sum {{ tarball }} | awk '{print $1}') && \
tar zxf {{ tarball }} && \
chown -R elasticsearch:elasticsearch elasticsearch-{{ elastic_version }} && \
mv elasticsearch-{{ elastic_version }}/* . && \
rmdir elasticsearch-{{ elastic_version }} && \
rm elasticsearch-{{ elastic_version }}.tar.gz
RUN set -ex && for esdirs in config data logs; do \
mkdir -p "$esdirs"; \
chown -R elasticsearch:elasticsearch "$esdirs"; \
done
USER elasticsearch
# Install x-pack and also the ingest-{agent,geoip} modules required for Filebeat
{% if staging_build_num -%}
RUN for PLUGIN_TO_INST in {{ plugin_list }}; do eval ES_JAVA_OPTS="-Des.plugins.staging={{ staging_build_num }}" elasticsearch-plugin install --batch "$PLUGIN_TO_INST"; done
{% else -%}
RUN for PLUGIN_TO_INST in {{ plugin_list }}; do elasticsearch-plugin install --batch "$PLUGIN_TO_INST"; done
{% endif-%}
COPY elasticsearch.yml config/
COPY log4j2.properties config/
COPY bin/es-docker bin/es-docker
USER root
RUN chown elasticsearch:elasticsearch config/elasticsearch.yml config/log4j2.properties bin/es-docker && \
chmod 0750 bin/es-docker
USER elasticsearch
CMD ["/bin/bash", "bin/es-docker"]
EXPOSE 9200 9300