<commit_before>FROM rvernica/scidb:15.12-pre


## Build SciDB (leftover)
RUN $SCIDB_SOURCE_PATH/run.py make -j2


ARG SCIDB_INSTANCE_NUM=2
ARG SCIDB_NAME=scidb
ARG SCIDB_LOG_LEVEL=WARN

ENV SCIDB_INSTANCE_NUM=$SCIDB_INSTANCE_NUM \
    SCIDB_NAME=$SCIDB_NAME \
    SCIDB_DATA_PATH=$SCIDB_INSTALL_PATH/DB-$SCIDB_NAME

# ENV SCIDB_SHIM=shim_${SCIDB_VER}_amd64.deb


## Setup SSH
RUN sed --in-place \
        's/session\s*required\s*pam_loginuid.so/session optional pam_loginuid.so/g' \
        /etc/pam.d/sshd && \
    echo 'StrictHostKeyChecking no' >> /etc/ssh/ssh_config && \
    ssh-keygen -f /root/.ssh/id_rsa -q -N "" && \
    cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys


## Setup PostgreSQL and SciDB
RUN echo "127.0.0.1:5432:$SCIDB_NAME:$SCIDB_NAME:`date +%s | sha256sum | base64 | head -c 32`" \
        > /root/.pgpass && \
    chmod go-r /root/.pgpass && \
    service ssh start && \
    service postgresql start && \
    echo n | $SCIDB_SOURCE_PATH/run.py install && \
    sed --in-place \
        s/log4j.rootLogger=DEBUG/log4j.rootLogger=$SCIDB_LOG_LEVEL/ \
        $SCIDB_INSTALL_PATH/share/scidb/log1.properties


## Install Shim
# RUN wget --no-verbose --output-document /tmp/$SCIDB_SHIM \
#         http://paradigm4.github.io/shim/$SCIDB_SHIM && \
#     dpkg --install /tmp/$SCIDB_SHIM && rm /tmp/$SCIDB_SHIM
RUN apt-key adv \
        --keyserver hkp://keyserver.ubuntu.com --recv 46BD98A354BA5235 && \
    echo "deb https://dl.bintray.com/rvernica/deb jessie main" > \
        /etc/apt/sources.list.d/bintray.list && \
    apt-get update && apt-get install --assume-yes --no-install-recommends \
        shim


COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]


## Port | App
## -----+-----
## 1239 | SciDB iquery
## 8080 | SciDB Shim (HTTP)
## 8083 | SciDB Shim (HTTPS)
EXPOSE 1239 8080 8083
<commit_msg>Get and build Shim from GitHub Install as a service Ubuntu deb package for Shim from GitHub depends on libprotobuf8 which is not available in Debian. Only 7 and 9 are available.<commit_after>FROM rvernica/scidb:15.12-pre


## Build SciDB (leftover)
RUN $SCIDB_SOURCE_PATH/run.py make -j2


ARG SCIDB_INSTANCE_NUM=2
ARG SCIDB_NAME=scidb
ARG SCIDB_LOG_LEVEL=WARN

ENV SCIDB_INSTANCE_NUM=$SCIDB_INSTANCE_NUM \
    SCIDB_NAME=$SCIDB_NAME \
    SCIDB_DATA_PATH=$SCIDB_INSTALL_PATH/DB-$SCIDB_NAME

ENV SCIDB_SHIM=6db32a89d92ca05ca3c7475917aef04d18d82c97


## Setup SSH
RUN sed --in-place \
        's/session\s*required\s*pam_loginuid.so/session optional pam_loginuid.so/g' \
        /etc/pam.d/sshd && \
    echo 'StrictHostKeyChecking no' >> /etc/ssh/ssh_config && \
    ssh-keygen -f /root/.ssh/id_rsa -q -N "" && \
    cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys


## Setup PostgreSQL and SciDB
RUN echo "127.0.0.1:5432:$SCIDB_NAME:$SCIDB_NAME:`date +%s | sha256sum | base64 | head -c 32`" \
        > /root/.pgpass && \
    chmod go-r /root/.pgpass && \
    service ssh start && \
    service postgresql start && \
    echo n | $SCIDB_SOURCE_PATH/run.py install && \
    sed --in-place \
        s/log4j.rootLogger=DEBUG/log4j.rootLogger=$SCIDB_LOG_LEVEL/ \
        $SCIDB_INSTALL_PATH/share/scidb/log1.properties



## Install Shim
RUN wget --no-verbose --output-document - \
        https://github.com/Paradigm4/shim/archive/$SCIDB_SHIM.tar.gz | \
        tar --extract --gzip --directory=/usr/local/src && \
    cd /usr/local/src/shim-$SCIDB_SHIM && \
    rm --recursive src/network src/util && \
    cp --recursive $SCIDB_SOURCE_PATH/src/network                     src && \
    cp --recursive $SCIDB_SOURCE_PATH/src/util                        src && \
    cp --recursive $SCIDB_SOURCE_PATH/stage/build/src/network/proto/* src/network/proto && \
    make service


COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]


## Port | App
## -----+-----
## 1239 | SciDB iquery
## 8080 | SciDB Shim (HTTP)
## 8083 | SciDB Shim (HTTPS)
EXPOSE 1239 8080 8083

{'fraction_non_alphanumeric': 0.14256567202244325, 'fraction_numerical': 0.03647028819178781, 'mean_word_length': 2.756704980842912, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3477625', 'n_tokens_mistral': 1667, 'n_tokens_neox': 1509, 'n_words': 283}