<commit_before># Dockerfile for ELK stack

# Build with:
# docker build -t <repo-user>/elk .

# Run with:
# docker run -d --name elk <repo-user>/elk
# or
# docker run -p 80:5601 -p 9200:9200 -p 5044:5044 -p 5000:5000 -it --name elk <repo-user>/elk

#FROM java:8-jre
# This image is officially deprecated in favor of the openjdk image,
# and will receive no further updates after 2016-12-31 (Dec 31, 2016)

# Change to OpenJDK
FROM openjdk:8-jre-alpine
# OS is Alpine 64bit

MAINTAINER <NAME> <<EMAIL>>
# Reference Sebastien Pujadas http://pujadas.net

ENV ES_VERSION 2.4.0
ENV LOGSTASH_VERSION 2.4.0
ENV KIBANA_VERSION 4.6.1

ENV GOSU_VERSION 1.9

####################################################
########               Java              ###########
####################################################
# OpenJDK - Java 8

# They are defined in the base image openjdk:8-jre-alpine
# ENV JAVA_VERSION 8u92
# ENV JAVA_ALPINE_VERSION 8.92.14-r1
# ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk/jre
# ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin

###############################################################################
#                                INSTALLATION
###############################################################################

### install prerequisites (cURL, gosu)

####################################################
#########              GoSU              ###########
####################################################

### install gosu for easy step-down from root
### https://github.com/tianon/gosu/releases

RUN set -x \
    && apk add --no-cache --virtual .gosu-deps \
        dpkg \
        gnupg \
        openssl \
    && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
    && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
    && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
    && export GNUPGHOME="$(mktemp -d)" \
    && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys <KEY> \
    && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
    && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
    && chmod +x /usr/local/bin/gosu \
    && gosu nobody true \
    && apk del .gosu-deps


####################################################
#########              Elasticsearch     ###########
####################################################

ENV ES_HOME /opt/elasticsearch

RUN set -ex \
 && mkdir -p ${ES_HOME} \
 && addgroup --gid 1100 elk \
 && adduser --disabled-password --disabled-login --gecos '' --uid 1100 --gid 1100 elk \
 && curl -L -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/${ES_VERSION}/elasticsearch-${ES_VERSION}.tar.gz \
 && tar xzf elasticsearch-${ES_VERSION}.tar.gz  -C ${ES_HOME} --strip-components=1 \
 && rm -rf elasticsearch-${ES_VERSION}.tar.gz \
 && for path in \
      ${ES_HOME}/data \
      ${ES_HOME}/logs \
      ${ES_HOME}/config \
      ${ES_HOME}/config/scripts \
      ; do \
      mkdir -p "$path"; \<commit_msg>Add ELK group and user in Alpine<commit_after># Dockerfile for ELK stack

# Build with:
# docker build -t <repo-user>/elk .

# Run with:
# docker run -d --name elk <repo-user>/elk
# or
# docker run -p 80:5601 -p 9200:9200 -p 5044:5044 -p 5000:5000 -it --name elk <repo-user>/elk

#FROM java:8-jre
# This image is officially deprecated in favor of the openjdk image,
# and will receive no further updates after 2016-12-31 (Dec 31, 2016)

# Change to OpenJDK
FROM openjdk:8-jre-alpine
# OS is Alpine 64bit

MAINTAINER <NAME> <<EMAIL>>
# Reference Sebastien Pujadas http://pujadas.net

ENV ES_VERSION 2.4.0
ENV LOGSTASH_VERSION 2.4.0
ENV KIBANA_VERSION 4.6.1

ENV GOSU_VERSION 1.9

####################################################
########               Java              ###########
####################################################
# OpenJDK - Java 8

# They are defined in the base image openjdk:8-jre-alpine
# ENV JAVA_VERSION 8u92
# ENV JAVA_ALPINE_VERSION 8.92.14-r1
# ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk/jre
# ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin

###############################################################################
#                                INSTALLATION
###############################################################################

### install prerequisites (cURL, gosu)

####################################################
#########              GoSU              ###########
####################################################

### install gosu for easy step-down from root
### https://github.com/tianon/gosu/releases

RUN set -x \
    && apk add --no-cache --virtual .gosu-deps \
        dpkg \
        gnupg \
        openssl \
    && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
    && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
    && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
    && export GNUPGHOME="$(mktemp -d)" \
    && gpg --keyserver ha.pool.sks-<EMAIL>servers.<EMAIL> --recv-keys <KEY> \
    && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
    && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
    && chmod +x /usr/local/bin/gosu \
    && gosu nobody true \
    && apk del .gosu-deps


####################################################
#########              Elasticsearch     ###########
####################################################

ENV ES_HOME /opt/elasticsearch

RUN set -ex \
 && mkdir -p ${ES_HOME} \
 && addgroup elk \
 && adduser -D -S elk -s /bin/bash -h ${ES_HOME} -g "ELK service user" -G elk \ 
 && curl -L -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/${ES_VERSION}/elasticsearch-${ES_VERSION}.tar.gz \
 && tar xzf elasticsearch-${ES_VERSION}.tar.gz  -C ${ES_HOME} --strip-components=1 \
 && rm -rf elasticsearch-${ES_VERSION}.tar.gz \
 && for path in \
      ${ES_HOME}/data \
      ${ES_HOME}/logs \
      ${ES_HOME}/config \
      ${ES_HOME}/config/scripts \
      ; do \
      mkdir -p "$path"; \
{'fraction_non_alphanumeric': 0.29515696482094966, 'fraction_numerical': 0.02618709575642846, 'mean_word_length': 3.095607235142119, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6086848', 'n_tokens_mistral': 2267, 'n_tokens_neox': 2070, 'n_words': 453}