Last active
June 6, 2019 14:14
-
-
Save andsens/40e8ca783f116050f83cce7245117f0b to your computer and use it in GitHub Desktop.
Kibana docker container with pre-optimized bundles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG KIBANA_VERSION | |
FROM docker.elastic.co/kibana/kibana:${KIBANA_VERSION} | |
ARG KIBANA_VERSION | |
ARG LOGTRAIL_VERSION | |
USER root | |
RUN NODE_OPTIONS="--max_old_space_size=4096" kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v${LOGTRAIL_VERSION}/logtrail-${KIBANA_VERSION}-${LOGTRAIL_VERSION}.zip | |
COPY kibana.yaml /usr/share/kibana/config/kibana.yml | |
COPY elasticsearch.repo /etc/yum.repos.d/elasticsearch.repo | |
RUN \ | |
set -e; \ | |
yum install -y sudo java-11-openjdk-headless.x86_64 elasticsearch; \ | |
( \ | |
set -e; \ | |
sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch &>/tmp/elasticsearch & \ | |
line=0; \ | |
until grep -qm 1 'LicenseService.*license.*mode \[basic\] - valid' /tmp/elasticsearch; do \ | |
sleep 1; \ | |
tail -qn +$((line+1)) /tmp/elasticsearch; \ | |
line=$(wc -l /tmp/elasticsearch | cut -d' ' -f1); \ | |
pgrep -u elasticsearch >/dev/null; \ | |
done; \ | |
echo 'Elasticsearch started' \ | |
); \ | |
( \ | |
set -e; \ | |
NODE_OPTIONS="--max_old_space_size=4096" sudo -u kibana /usr/local/bin/kibana-docker &>/tmp/kibana & \ | |
line=0; \ | |
until grep -qm 1 'Optimization of bundles for .* complete in .* seconds' /tmp/kibana; do \ | |
sleep 1; \ | |
tail -qn +$((line+1)) /tmp/kibana; \ | |
line=$(wc -l /tmp/kibana | cut -d' ' -f1); \ | |
pgrep -u kibana >/dev/null; \ | |
done \ | |
); \ | |
pkill -u elasticsearch; \ | |
pkill -u kibana; \ | |
until pgrep -u elasticsearch >/dev/null; do sleep 1; done; \ | |
until pgrep -u kibana >/dev/null; do sleep 1; done; \ | |
yum remove -y sudo java-11-openjdk-headless.x86_64 elasticsearch; \ | |
rm /etc/yum.repos.d/elasticsearch.repo; \ | |
yum -y autoremove; \ | |
yum clean all; \ | |
rm -rf /var/cache/yum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[elasticsearch-7.x] | |
name=Elasticsearch repository for 7.x packages | |
baseurl=https://artifacts.elastic.co/packages/7.x/yum | |
gpgcheck=1 | |
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch | |
enabled=1 | |
autorefresh=1 | |
type=rpm-md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elasticsearch.hosts: http://127.0.0.1:9200 | |
server.name: kibana | |
server.host: 0.0.0.0 | |
xpack.apm.ui.enabled: false | |
xpack.graph.enabled: false | |
xpack.grokdebugger.enabled: false | |
xpack.searchprofiler.enabled: false | |
xpack.ml.enabled: false | |
xpack.monitoring.enabled: false | |
xpack.reporting.enabled: false | |
xpack.security.enabled: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated. Reduced size by not using a build container and instead simply uninstall ES after optimization is done.
This reduces the image size from ~1.6GB to 794MB, only 60MB more than the elastico base.