mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-04-20 06:02:24 +00:00
elasticsearch, kibana: prep for multiarch, move to ubuntu
heade: alpine 3.15
This commit is contained in:
parent
a507bc5f39
commit
cfcf870da3
3 changed files with 53 additions and 51 deletions
|
@ -1,44 +1,43 @@
|
|||
FROM alpine:3.15
|
||||
FROM ubuntu:20.04
|
||||
#
|
||||
# VARS
|
||||
ENV ES_VER=7.16.3 \
|
||||
ES_JAVA_HOME=/usr/lib/jvm/java-16-openjdk
|
||||
|
||||
ENV ES_VER=7.16.3
|
||||
#
|
||||
# Include dist
|
||||
ADD dist/ /root/dist/
|
||||
#
|
||||
RUN apk -U --no-cache add \
|
||||
aria2 \
|
||||
bash \
|
||||
curl \
|
||||
nss && \
|
||||
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community openjdk16-jre && \
|
||||
RUN apt-get update -y && \
|
||||
apt-get dist-upgrade -y && \
|
||||
apt-get install -y \
|
||||
aria2 \
|
||||
curl && \
|
||||
#
|
||||
# Get and install packages
|
||||
# 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/ && \
|
||||
mkdir -p /usr/share/elasticsearch/ && \
|
||||
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 && \
|
||||
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 && \
|
||||
#
|
||||
# Add and move files
|
||||
cd /root/dist/ && \
|
||||
rm -rf /usr/share/elasticsearch/modules/x-pack-ml && \
|
||||
mkdir -p /usr/share/elasticsearch/config && \
|
||||
cp elasticsearch.yml /usr/share/elasticsearch/config/ && \
|
||||
cp elasticsearch.yml /etc/elasticsearch/ && \
|
||||
#
|
||||
# Setup user, groups and configs
|
||||
addgroup -g 2000 elasticsearch && \
|
||||
adduser -S -H -s /bin/ash -u 2000 -D -g 2000 elasticsearch && \
|
||||
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/ && \
|
||||
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 && \
|
||||
#
|
||||
# Clean up
|
||||
apk del --purge aria2 && \
|
||||
rm -rf /root/* && \
|
||||
rm -rf /tmp/* && \
|
||||
rm -rf /var/cache/apk/*
|
||||
apt-get purge aria2 -y && \
|
||||
apt-get autoremove -y --purge && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/dist
|
||||
#
|
||||
# Healthcheck
|
||||
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:9200/_cat/health'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM alpine:3.14
|
||||
FROM alpine:3.15
|
||||
#
|
||||
# Setup env and apt
|
||||
RUN apk -U add \
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
FROM node:16.13.0-alpine3.14
|
||||
FROM ubuntu:20.04
|
||||
#
|
||||
# VARS
|
||||
ENV KB_VER=7.16.3
|
||||
#
|
||||
# Include dist
|
||||
ADD dist/ /root/dist/
|
||||
#
|
||||
RUN apk -U --no-cache add \
|
||||
RUN apt-get update -y && \
|
||||
apt-get dist-upgrade -y && \
|
||||
apt-get install -y \
|
||||
aria2 \
|
||||
curl \
|
||||
gcompat && \
|
||||
curl && \
|
||||
#
|
||||
# Get and install packages
|
||||
cd /root/dist/ && \
|
||||
mkdir -p /usr/share/kibana/ && \
|
||||
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/ && \
|
||||
#
|
||||
# Kibana's bundled node does not work in alpine
|
||||
rm /usr/share/kibana/node/bin/node && \
|
||||
ln -s /usr/local/bin/node /usr/share/kibana/node/bin/node && \
|
||||
#
|
||||
# Add and move files
|
||||
# Determine arch, get and install packages
|
||||
ARCH=$(arch) && \
|
||||
if [ "$ARCH" = "x86_64" ]; then KB_ARCH="amd64"; fi && \
|
||||
if [ "$ARCH" = "aarch64" ]; then KB_ARCH="arm64"; fi && \
|
||||
echo "$ARCH" && \
|
||||
cd /root/dist/ && \
|
||||
aria2c -s 16 -x 16 https://artifacts.elastic.co/downloads/kibana/kibana-$KB_VER-$KB_ARCH.deb && \
|
||||
dpkg -i kibana-$KB_VER-$KB_ARCH.deb && \
|
||||
#
|
||||
# Setup user, groups and configs
|
||||
mkdir -p /usr/share/kibana/config \
|
||||
/usr/share/kibana/data && \
|
||||
cp /etc/kibana/kibana.yml /usr/share/kibana/config && \
|
||||
sed -i 's/#server.basePath: ""/server.basePath: "\/kibana"/' /usr/share/kibana/config/kibana.yml && \
|
||||
sed -i 's/#server.host: "localhost"/server.host: "0.0.0.0"/' /usr/share/kibana/config/kibana.yml && \
|
||||
sed -i 's/#elasticsearch.hosts: \["http:\/\/localhost:9200"\]/elasticsearch.hosts: \["http:\/\/elasticsearch:9200"\]/' /usr/share/kibana/config/kibana.yml && \
|
||||
|
@ -36,15 +35,19 @@ RUN apk -U --no-cache add \
|
|||
echo "kibana.autocompleteTerminateAfter: 1000000" >> /usr/share/kibana/config/kibana.yml && \
|
||||
rm -rf /usr/share/kibana/optimize/bundles/* && \
|
||||
/usr/share/kibana/bin/kibana --optimize --allow-root && \
|
||||
addgroup -g 2000 kibana && \
|
||||
adduser -S -H -s /bin/ash -u 2000 -D -g 2000 kibana && \
|
||||
chown -R kibana:kibana /usr/share/kibana/ && \
|
||||
groupmod -g 2000 kibana && \
|
||||
usermod -u 2000 kibana && \
|
||||
chown -R root:kibana /etc/kibana && \
|
||||
chown -R kibana:kibana /usr/share/kibana/data \
|
||||
/run/kibana \
|
||||
/var/log/kibana \
|
||||
/var/lib/kibana && \
|
||||
chmod 755 -R /usr/share/kibana/config && \
|
||||
#
|
||||
# Clean up
|
||||
apk del --purge aria2 && \
|
||||
rm -rf /root/* && \
|
||||
rm -rf /tmp/* && \
|
||||
rm -rf /var/cache/apk/*
|
||||
apt-get purge aria2 -y && \
|
||||
apt-get autoremove -y --purge && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/dist
|
||||
#
|
||||
# Healthcheck
|
||||
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:5601'
|
||||
|
|
Loading…
Reference in a new issue