tpotce/docker/elk/head/Dockerfile

35 lines
1 KiB
Text
Raw Normal View History

FROM alpine
2019-08-16 17:29:41 +00:00
#
# Setup env and apt
RUN apk -U add \
curl \
git \
nodejs \
nodejs-npm && \
2019-08-16 17:29:41 +00:00
#
# Get and install packages
mkdir -p /usr/src/app/ && \
cd /usr/src/app/ && \
2018-05-16 14:57:52 +00:00
git clone --depth=1 https://github.com/mobz/elasticsearch-head . && \
npm install http-server && \
2018-08-01 20:09:05 +00:00
sed -i "s#\"http\:\/\/localhost\:9200\"#window.location.protocol \+ \'\/\/\' \+ window.location.hostname \+ \'\:\' \+ window.location.port \+ \'\/es\/\'#" /usr/src/app/_site/app.js && \
2019-08-16 17:29:41 +00:00
#
# Setup user, groups and configs
addgroup -g 2000 head && \
2018-05-16 14:57:52 +00:00
adduser -S -H -s /bin/ash -u 2000 -D -g 2000 head && \
chown -R head:head /usr/src/app/ && \
2019-08-16 17:29:41 +00:00
#
# Clean up
apk del --purge git && \
rm -rf /root/* && \
rm -rf /tmp/* && \
rm -rf /var/cache/apk/*
2019-08-16 17:29:41 +00:00
#
# Healthcheck
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:9100'
2019-08-16 17:29:41 +00:00
#
# Start elasticsearch-head
2018-03-31 15:18:28 +00:00
USER head:head
WORKDIR /usr/src/app
CMD ["node_modules/http-server/bin/http-server", "_site", "-p", "9100"]