<commit_before>FROM centos:7
LABEL maintainer="USGS EROS LCMAP http://eros.usgs.gov http://github.com/usgs-eros"
LABEL description="CentOS based Mesos Image for LCMAP"

ENV SPARK_HOME=/opt/spark
ENV SPARK_NO_DAEMONIZE=true
ENV PYSPARK_PYTHON=/home/firebird/miniconda3/bin/python3
ENV MESOS_NATIVE_JAVA_LIBRARY=/usr/lib/libmesos.so
ENV PATH=/home/firebird/miniconda3/bin:$SPARK_HOME/bin:${PATH}
ENV PYTHONPATH=$PYTHONPATH:$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.10.4-src.zip:$SPARK_HOME/python/lib/pyspark.zip

ENV LC_ALL=en_US.UTF-8 \
    LANG=en_US.UTF-8

EXPOSE 8081 4040 8888

RUN yum update -y && \
    yum install -y bzip2 java-1.8.0-openjdk-devel.i686 && \
    yum -y install http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm && \
    yum install -y mesos  && \
    yum -y downgrade mesos-1.1.0

RUN cd /opt && \
    curl https://d3kbcqa49mib13.cloudfront.net/spark-2.2.0-bin-hadoop2.7.tgz -o spark.tgz && \
    tar -zxf spark.tgz && \
    rm -rf spark.tgz && \
    ln -s spark-* spark

RUN adduser -ms /bin/bash firebird
USER firebird
WORKDIR /home/firebird

RUN curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o mc.sh && \
    chmod 755 mc.sh && \
    ./mc.sh -b && \
    rm -rf mc.sh && \
    conda config --add channels conda-forge && \
    conda install cython gdal --yes && \
    conda clean --all

COPY firebird .
COPY notebooks notebook
COPY resources .
COPY test .
COPY Makefile .
COPY pom.xml .
COPY README.md .
COPY setup.py .
COPY version.py .

USER root
RUN cd /home/firebird && \
    yum install -y maven && \
    mvn dependency:copy-dependencies -DoutputDirectory=$SPARK_HOME/jars && \
    yum erase -y maven && \
    yum clean all

# USER firebird
WORKDIR /home/firebird<commit_msg>Dockerfile modified to run as user app, with full sudo privs.  This is a safety measure to prevent accessing mounted volume disks as root<commit_after>FROM centos:7

LABEL maintainer="USGS EROS LCMAP http://eros.usgs.gov http://github.com/usgs-eros/lcmap-firebird"
LABEL description="CentOS based Spark-Mesos image for LCMAP"
LABEL org.apache.mesos.version=1.1.0
LABEL org.apache.spark.version=2.2.0
LABEL net.java.openjdk.version=1.8.0
LABEL org.python.version=3.6

EXPOSE 8081 4040 8888

RUN yum update -y && \
    yum install -y sudo \
                   bzip2 \
                   java-1.8.0-openjdk-devel.i686 \
                   http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm \
                   mesos && \
    yum -y downgrade mesos-1.1.0

##########################################################################
# Add a user to run as inside the container.  This will prevent accidental
# foo while mounting volumes.  To enable access between external and 
# internal users on mounted volume files, set 'other' perms appropriately.
##########################################################################
RUN adduser -ms /bin/bash app && \
    echo "app ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/app && \
    chmod 0440 /etc/sudoers.d/app

ENV HOME=/home/app
ENV USER=app
USER $USER
WORKDIR $HOME
##########################################################################

ENV SPARK_HOME=/opt/spark
ENV SPARK_NO_DAEMONIZE=true
ENV PYSPARK_PYTHON=$HOME/miniconda3/bin/python3
ENV MESOS_NATIVE_JAVA_LIBRARY=/usr/lib/libmesos.so
ENV PATH=$HOME/miniconda3/bin:$SPARK_HOME/bin:${PATH}
ENV PYTHONPATH=$PYTHONPATH:$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.10.4-src.zip:$SPARK_HOME/python/lib/pyspark.zip
ENV LC_ALL=en_US.UTF-8 \
    LANG=en_US.UTF-8

RUN cd /opt && \
    sudo curl https://d3kbcqa49mib13.cloudfront.net/spark-2.2.0-bin-hadoop2.7.tgz -o spark.tgz && \
    sudo tar -zxf spark.tgz && \
    sudo rm -rf spark.tgz && \
    sudo ln -s spark-* spark

RUN curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o mc.sh && \
    chmod 755 mc.sh && \
    ./mc.sh -b && \
    rm -rf mc.sh && \
    conda config --add channels conda-forge && \
    conda install cython gdal --yes && \
    conda clean --all

COPY firebird firebird
COPY notebooks notebook
COPY resources resources
COPY test test
COPY Makefile .
COPY pom.xml .
COPY README.md .
COPY setup.py .
COPY version.py .

RUN sudo chown -R app:app .

RUN cd $HOME && \
    sudo yum install -y maven && \
    sudo mvn dependency:copy-dependencies -DoutputDirectory=$SPARK_HOME/jars && \
    sudo yum erase -y maven && \
    sudo yum clean all

{'fraction_non_alphanumeric': 0.16963280018022078, 'fraction_numerical': 0.027708943455733274, 'mean_word_length': 3.0921658986175116, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, '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': '2908393', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1616, 'n_words': 378}