Added seed code for caas-logging.
[ta/caas-logging.git] / docker-build / elasticsearch / Dockerfile
1 # Copyright 2019 Nokia
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 FROM centos:7.6.1810
16 MAINTAINER Levente Kale <levente.kale@nokia.com>
17
18 ARG VERSION
19 ENV ES_VERSION=$VERSION
20
21 ENV PATH /usr/share/elasticsearch/bin:$PATH
22 ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk
23 ENV DOWNLOAD_URL "https://artifacts.elastic.co/downloads/elasticsearch"
24 ENV ES_TARBAL "${DOWNLOAD_URL}/elasticsearch-${ES_VERSION}.tar.gz"
25 ENV ES_TARBALL_ASC "${DOWNLOAD_URL}/elasticsearch-${ES_VERSION}.tar.gz.asc"
26 ENV EXPECTED_SHA_URL "${DOWNLOAD_URL}/elasticsearch-${ES_VERSION}.tar.gz.sha512"
27
28 WORKDIR /usr/share/elasticsearch
29
30 RUN groupadd -g 202 elasticsearch \
31 &&  adduser -u 202 -g 202 -d /usr/share/elasticsearch elasticsearch \
32 &&  yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
33 &&  yum install -y --setopt=skip_missing_names_on_install=False \
34       java-1.8.0-openjdk-headless \
35       unzip \
36       which \
37       coreutils \
38       cronie \
39       supervisor \
40 &&  yum clean all \
41 &&  curl -fsSL ${ES_TARBAL} | tar zx --strip-components=1 \
42 &&  echo "===> Creating Elasticsearch Paths..." \
43     && for path in \
44         /usr/share/elasticsearch/data \
45         /usr/share/elasticsearch/logs \
46         /usr/share/elasticsearch/config \
47         /usr/share/elasticsearch/config/scripts \
48         /usr/share/elasticsearch/plugins \
49     ; do \
50         mkdir -p "$path"; \
51         chown -R elasticsearch:elasticsearch "$path"; \
52     done
53
54 COPY config/elastic /usr/share/elasticsearch/config
55 COPY config/logrotate /etc/logrotate.d/elasticsearch
56 COPY healthcheck /usr/local/bin/
57 COPY elasticsearch-setindex /usr/share/elasticsearch
58
59 RUN chown -R elasticsearch:elasticsearch /usr/share/elasticsearch /etc/logrotate.d/elasticsearch /usr/local/bin/healthcheck \
60 &&  chmod +x /usr/share/elasticsearch/elasticsearch-setindex
61
62 CMD ["elasticsearch"]