tpotce/docker/elk/elasticsearch/Dockerfile

51 lines
1.7 KiB
Text
Raw Normal View History

FROM alpine:3.14
2019-08-15 15:38:12 +00:00
#
2020-01-31 14:21:55 +00:00
# VARS
ENV ES_VER=7.15.0 \
ES_JAVA_HOME=/usr/lib/jvm/java-16-openjdk
# Include dist
ADD dist/ /root/dist/
2019-08-15 15:38:12 +00:00
#
# Setup env and apt
2021-02-12 13:54:42 +00:00
#RUN sed -i 's/dl-cdn/dl-2/g' /etc/apk/repositories && \
RUN apk -U --no-cache add \
aria2 \
2018-05-16 14:57:52 +00:00
bash \
curl \
nss && \
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing openjdk16-jre && \
2019-08-15 15:38:12 +00:00
#
# Get and install packages
cd /root/dist/ && \
mkdir -p /usr/share/elasticsearch/ && \
2020-01-31 14:21:55 +00:00
aria2c -s 16 -x 16 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VER-linux-x86_64.tar.gz && \
tar xvfz elasticsearch-$ES_VER-linux-x86_64.tar.gz --strip-components=1 -C /usr/share/elasticsearch/ && \
rm -rf /usr/share/elasticsearch/jdk && \
rm -rf /usr/share/elasticsearch/modules/x-pack-ml && \
# For some reason Alpine 3.14 does not report the -x flag correctly and thus elasticsearch does not find java
sed -i 's/! -x/! -e/g' /usr/share/elasticsearch/bin/elasticsearch-env && \
2019-08-15 15:38:12 +00:00
#
# Add and move files
cd /root/dist/ && \
mkdir -p /usr/share/elasticsearch/config && \
cp elasticsearch.yml /usr/share/elasticsearch/config/ && \
2019-08-15 15:38:12 +00:00
#
# Setup user, groups and configs
addgroup -g 2000 elasticsearch && \
2018-05-16 14:57:52 +00:00
adduser -S -H -s /bin/ash -u 2000 -D -g 2000 elasticsearch && \
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/ && \
2019-08-15 15:38:12 +00:00
#
# Clean up
apk del --purge aria2 && \
rm -rf /root/* && \
rm -rf /tmp/* && \
rm -rf /var/cache/apk/*
2019-08-15 15:38:12 +00:00
#
# Healthcheck
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:9200/_cat/health'
2019-08-15 15:38:12 +00:00
#
# Start ELK
2018-03-31 15:18:28 +00:00
USER elasticsearch:elasticsearch
2018-05-16 14:57:52 +00:00
CMD ["/usr/share/elasticsearch/bin/elasticsearch"]