<commit_before>FROM ubuntu:16.04

MAINTAINER <NAME> <<EMAIL>>

# Explicitly become root (even though likely we are root already)
USER root

# Override the default shell (sh) with bash
RUN rm /bin/sh && ln -s /bin/bash /bin/sh

# Update repositories and install packages
RUN apt-get update && apt-get install -y python2.7 python2.7-dev curl git subversion git build-essential bzip2 libbz2-dev

#Create link for python
RUN ln -s /usr/bin/python2.7 /usr/bin/python

# Install dependencies for ROOT
RUN apt-get install -y dpkg-dev cmake binutils libpng12-dev libjpeg-dev gfortran libssl-dev libfftw3-dev libcfitsio-dev python-dev libgsl0-dev libx11-dev libxpm-dev libxft-dev libxext-dev

# Create user hawc
RUN groupadd -r hawc -g 433
RUN useradd -u 431 -r -g hawc -s /bin/bash -c "hawc user" hawc
RUN mkdir -p /home/hawc
RUN chown -R hawc:hawc /home/hawc

# Become that user
USER hawc

##############################
#       AERIE BUILD
##############################

# Setup for build
ENV SOFTWARE_BASE=/home/hawc/hawc_software

RUN mkdir -p $SOFTWARE_BASE/externals/
RUN mkdir -p $SOFTWARE_BASE/externals/tmp

# Copy the AERIE code from the host
COPY ape-hawc-2.02.02.tar.bz2 /home/hawc/hawc_software/externals/
COPY aperc_2.02.02 /home/hawc/hawc_software/externals/

RUN cd $SOFTWARE_BASE/externals/ && tar xf ape-hawc-2.02.02.tar.bz2

ENV APERC=/home/hawc/hawc_software/externals/aperc_2.02.02

# Of course we do not want the password in the Dockerfile. You need to
# pass it as argument to docker build, using -build-arg hawcpasswd="[passwd]"
ARG hawcpasswd
RUN cd $SOFTWARE_BASE/externals/ape-hawc-2.02.02 && echo $hawcpasswd | ./ape --verbose --no-keep --rc=$APERC install externals

# Remove APE tar file
RUN cd $SOFTWARE_BASE/externals/ && rm -rf ape-hawc-2.02.02.tar.bz2

# Get the AERIE source code
COPY aerie.tar.gz /home/hawc/hawc_software/
RUN cd /home/hawc/hawc_software/ && tar xf aerie.tar.gz
RUN cd /home/hawc/hawc_software/ && rm -rf aerie.tar.gz

# Build AERIE
RUN cd $SOFTWARE_BASE/aerie/build && cmake -DCMAKE_INSTALL_PREFIX=../install ../src -DCMAKE_BUILD_TYPE=Release
RUN cd $SOFTWARE_BASE/aerie/build && make -j 4
RUN cd $SOFTWARE_BASE/aerie/build && make test
RUN cd $SOFTWARE_BASE/aerie/build && make install
# Setup environment

# Create workdir
RUN mkdir /home/hawc/workdir

# Set it as workdir
WORKDIR /home/hawc/workdir<commit_msg>Changed to make it work<commit_after>FROM ubuntu:16.04

MAINTAINER <NAME> <<EMAIL>>

# Explicitly become root (even though likely we are root already)
USER root

# Override the default shell (sh) with bash
RUN rm /bin/sh && ln -s /bin/bash /bin/sh

# Update repositories and install packages
RUN apt-get update && apt-get install -y python2.7 python2.7-dev curl git subversion git build-essential bzip2 libbz2-dev

#Create link for python
RUN ln -s /usr/bin/python2.7 /usr/bin/python

# Install dependencies for ROOT
RUN apt-get install -y dpkg-dev cmake binutils libpng12-dev libjpeg-dev gfortran libssl-dev libfftw3-dev libcfitsio-dev python-dev libgsl0-dev libx11-dev libxpm-dev libxft-dev libxext-dev

# Create user hawc
RUN groupadd -r hawc -g 433
RUN useradd -u 431 -r -g hawc -s /bin/bash -c "hawc user" hawc
RUN mkdir -p /home/hawc
RUN chown -R hawc:hawc /home/hawc

# ROOT look for libraries in some pre-defined paths, which unfortunately
# do not exist on Ubuntu. This trick solves the problem by creating /usr/lib64
# which usually does not exist and linking it to where the libraries live in Ubuntu 
RUN ln -s /usr/lib/x86_64-linux-gnu /usr/lib64 

# Become the hawc user, so the build is not owned by root 
USER hawc

##############################
#       AERIE BUILD
##############################

# Setup for build
ENV SOFTWARE_BASE=/home/hawc/hawc_software

RUN mkdir -p $SOFTWARE_BASE/externals/
RUN mkdir -p $SOFTWARE_BASE/externals/tmp

# Copy the AERIE code from the host
COPY ape-hawc-2.02.02.tar.bz2 /home/hawc/hawc_software/externals/
COPY aperc_2.02.02 /home/hawc/hawc_software/externals/

RUN cd $SOFTWARE_BASE/externals/ && tar xf ape-hawc-2.02.02.tar.bz2

ENV APERC=/home/hawc/hawc_software/externals/aperc_2.02.02

# Of course we do not want the password in the Dockerfile. You need to
# pass it as argument to docker build, using -build-arg hawcpasswd="[passwd]"
ARG hawcpasswd
RUN cd $SOFTWARE_BASE/externals/ape-hawc-2.02.02 && echo $hawcpasswd | ./ape --verbose --no-keep --rc=$APERC install externals

# Remove APE tar file
RUN cd $SOFTWARE_BASE/externals/ && rm -rf ape-hawc-2.02.02.tar.bz2

# Get the AERIE source code
COPY aerie.tar.gz /home/hawc/hawc_software/
RUN cd /home/hawc/hawc_software/ && tar xf aerie.tar.gz
RUN cd /home/hawc/hawc_software/ && rm -rf aerie.tar.gz

# Build AERIE
RUN cd $SOFTWARE_BASE/aerie/build && eval `$SOFTWARE_BASE/externals/ape-hawc-2.02.02/ape sh externals` && cmake -DCMAKE_INSTALL_PREFIX=../install ../src -DCMAKE_BUILD_TYPE=Release
RUN cd $SOFTWARE_BASE/aerie/build && make 
RUN cd $SOFTWARE_BASE/aerie/build && make test
RUN cd $SOFTWARE_BASE/aerie/build && make install
# Setup environment

# Create workdir
RUN mkdir /home/hawc/workdir

# Set it as workdir
WORKDIR /home/hawc/workdir
{'fraction_non_alphanumeric': 0.12419449326303457, 'fraction_numerical': 0.02499511814098809, 'mean_word_length': 3.8967495219885278, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '7404015', 'n_tokens_mistral': 2073, 'n_tokens_neox': 1846, 'n_words': 577}