tpotce/docker/elk/elasticsearch/Dockerfile

47 lines
1.5 KiB
Text
Raw Normal View History

FROM ubuntu:22.04
2019-08-15 15:38:12 +00:00
#
2020-01-31 14:21:55 +00:00
# VARS
2024-07-08 13:46:22 +00:00
ENV ES_VER=8.14.2
#
# Include dist
2022-03-08 23:36:03 +00:00
COPY dist/ /root/dist/
2019-08-15 15:38:12 +00:00
#
RUN apt-get update -y && \
apt-get install -y \
aria2 \
curl && \
#
# Determine arch, get and install packages
ARCH=$(arch) && \
if [ "$ARCH" = "x86_64" ]; then ES_ARCH="amd64"; fi && \
if [ "$ARCH" = "aarch64" ]; then ES_ARCH="arm64"; fi && \
echo "$ARCH" && \
cd /root/dist/ && \
aria2c -s 16 -x 16 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VER-$ES_ARCH.deb && \
dpkg -i elasticsearch-$ES_VER-$ES_ARCH.deb && \
2019-08-15 15:38:12 +00:00
#
# Add and move files
2022-02-16 02:55:20 +00:00
# rm -rf /usr/share/elasticsearch/modules/x-pack-ml && \
mkdir -p /usr/share/elasticsearch/config && \
cp elasticsearch.yml /etc/elasticsearch/ && \
2019-08-15 15:38:12 +00:00
#
# Setup user, groups and configs
groupmod -g 2000 elasticsearch && \
usermod -u 2000 elasticsearch && \
chown -R root:elasticsearch /etc/default/elasticsearch \
/etc/elasticsearch && \
chown -R elasticsearch:elasticsearch /var/lib/elasticsearch \
/var/log/elasticsearch && \
2019-08-15 15:38:12 +00:00
#
# Clean up
apt-get purge aria2 -y && \
apt-get autoremove -y --purge && \
2022-03-08 23:36:03 +00:00
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /root/*
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
2021-12-13 15:59:48 +00:00
CMD ["/usr/share/elasticsearch/bin/elasticsearch"]