2020-07-06 23:30:11 +00:00
|
|
|
FROM alpine:3.12
|
2019-08-16 17:29:41 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Setup env and apt
|
2018-11-22 23:18:59 +00:00
|
|
|
RUN apk -U add \
|
|
|
|
curl \
|
|
|
|
git \
|
|
|
|
nodejs \
|
|
|
|
nodejs-npm && \
|
2019-08-16 17:29:41 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Get and install packages
|
|
|
|
mkdir -p /usr/src/app/ && \
|
|
|
|
cd /usr/src/app/ && \
|
2020-09-04 12:37:28 +00:00
|
|
|
git clone https://github.com/mobz/elasticsearch-head . && \
|
|
|
|
git checkout d0a25608854479f0b3f2dca24e8039a2fd66b0e2 && \
|
2017-10-13 18:58:14 +00:00
|
|
|
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
|
|
|
#
|
2017-10-13 18:58:14 +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 && \
|
2017-10-13 18:58:14 +00:00
|
|
|
chown -R head:head /usr/src/app/ && \
|
2019-08-16 17:29:41 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Clean up
|
2018-11-22 23:18:59 +00:00
|
|
|
apk del --purge git && \
|
|
|
|
rm -rf /root/* && \
|
|
|
|
rm -rf /tmp/* && \
|
|
|
|
rm -rf /var/cache/apk/*
|
2019-08-16 17:29:41 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Healthcheck
|
|
|
|
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:9100'
|
2019-08-16 17:29:41 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Start elasticsearch-head
|
2018-03-31 15:18:28 +00:00
|
|
|
USER head:head
|
2017-10-13 18:58:14 +00:00
|
|
|
WORKDIR /usr/src/app
|
|
|
|
CMD ["node_modules/http-server/bin/http-server", "_site", "-p", "9100"]
|