tpotce/docker/elk/kibana/Dockerfile

68 lines
3.1 KiB
Text
Raw Normal View History

2021-12-13 15:59:48 +00:00
FROM node:16.13.0-alpine3.14
2019-08-15 15:38:12 +00:00
#
2020-01-31 14:21:55 +00:00
# VARS
ENV KB_VER=7.16.2
2020-01-31 14:21:55 +00:00
#
# 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 apk -U --no-cache add \
aria2 \
2021-02-12 13:21:35 +00:00
curl \
gcompat && \
2019-08-15 15:38:12 +00:00
#
# Get and install packages
cd /root/dist/ && \
mkdir -p /usr/share/kibana/ && \
2020-01-31 14:21:55 +00:00
aria2c -s 16 -x 16 https://artifacts.elastic.co/downloads/kibana/kibana-$KB_VER-linux-x86_64.tar.gz && \
tar xvfz kibana-$KB_VER-linux-x86_64.tar.gz --strip-components=1 -C /usr/share/kibana/ && \
2019-08-15 15:38:12 +00:00
#
# Kibana's bundled node does not work in alpine
rm /usr/share/kibana/node/bin/node && \
2020-01-31 14:21:55 +00:00
ln -s /usr/local/bin/node /usr/share/kibana/node/bin/node && \
2019-08-15 15:38:12 +00:00
#
# Add and move files
cd /root/dist/ && \
2019-08-15 15:38:12 +00:00
#
# Setup user, groups and configs
sed -i 's/#server.basePath: ""/server.basePath: "\/kibana"/' /usr/share/kibana/config/kibana.yml && \
sed -i 's/#kibana.defaultAppId: "home"/kibana.defaultAppId: "dashboards"/' /usr/share/kibana/config/kibana.yml && \
sed -i 's/#server.host: "localhost"/server.host: "0.0.0.0"/' /usr/share/kibana/config/kibana.yml && \
2019-02-28 14:52:42 +00:00
sed -i 's/#elasticsearch.hosts: \["http:\/\/localhost:9200"\]/elasticsearch.hosts: \["http:\/\/elasticsearch:9200"\]/' /usr/share/kibana/config/kibana.yml && \
2018-11-23 22:32:11 +00:00
sed -i 's/#server.rewriteBasePath: false/server.rewriteBasePath: false/' /usr/share/kibana/config/kibana.yml && \
echo "xpack.infra.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
echo "xpack.logstash.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
echo "xpack.canvas.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
echo "xpack.spaces.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
2020-03-05 21:20:11 +00:00
echo "xpack.apm.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
2020-01-31 14:21:55 +00:00
echo "xpack.security.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
2019-08-15 15:38:12 +00:00
echo "xpack.uptime.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
2020-08-20 15:03:16 +00:00
echo "xpack.securitySolution.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
2020-05-14 16:27:57 +00:00
echo "xpack.ml.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
2021-02-12 13:21:35 +00:00
echo "xpack.fleet.enabled: false" >> /usr/share/kibana/config/kibana.yml && \
echo "elasticsearch.requestTimeout: 60000" >> /usr/share/kibana/config/kibana.yml && \
echo "elasticsearch.shardTimeout: 60000" >> /usr/share/kibana/config/kibana.yml && \
2020-08-20 15:03:16 +00:00
# There is no switch to disable Enterprise Search, so we need to remove it
# In order to remove all X-Pack features we need to use OSS versions
rm -rf /usr/share/kibana/x-pack/plugins/enterprise_search && \
2019-02-28 14:52:42 +00:00
rm -rf /usr/share/kibana/optimize/bundles/* && \
2020-01-31 14:21:55 +00:00
/usr/share/kibana/bin/kibana --optimize --allow-root && \
addgroup -g 2000 kibana && \
2018-05-16 14:57:52 +00:00
adduser -S -H -s /bin/ash -u 2000 -D -g 2000 kibana && \
chown -R kibana:kibana /usr/share/kibana/ && \
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:5601'
2019-08-15 15:38:12 +00:00
#
# Start kibana
2018-09-11 12:19:26 +00:00
STOPSIGNAL SIGKILL
2018-03-31 15:18:28 +00:00
USER kibana:kibana
CMD ["/usr/share/kibana/bin/kibana"]