FROM ubuntu:14.04

ENV PACKAGES make gcc wget libc6-dev zlib1g-dev ca-certificates xz-utils

RUN apt-get update --fix-missing -y && apt-get install -y --no-install-recommends ${PACKAGES}

RUN apt-get install --fix-missing python git build-essential -y

RUN yes | perl -MCPAN -e "CPAN::Shell->notest(qw!install  List::MoreUtils!)"

RUN yes | perl -MCPAN -e "CPAN::Shell->notest(qw!install  Parallel::ForkManager!)"

RUN wget http://clark.cs.ucr.edu/Download/CLARKV1.2.6.tar.gz

RUN tar -xzvf CLARKV1.2.6.tar.gz

WORKDIR /CLARKSCV1.2.6.1

ADD getfilesToTaxNodes.cc src

RUN ls . -lhtr

RUN ./install.sh

ENV PATH ${PATH}:/CLARKSCV1.2.6.1

# Add Taskfile to /
ADD Taskfile /
# Add python scripts
ADD time100.py /
# Add modified dl data to kill the download
#ADD download_taxondata.sh /CLARKSCV1.2.6.1
#ADD updateTaxonomy.sh /CLARKSCV1.2.6.1
#ADD fix_fasta_header.py /
ADD prepare_results.py /
ADD reads.1.fastq /tmp/reads.1.fq
ADD reads.2.fastq /tmp/reads.2.fq
ADD gunzip.sh /
ADD prepare_inputs.sh /
# Add assemble script to the directory /usr/local/bin inside the container.
# /usr/local/bin is appended to the $PATH variable what means that every script
# in that directory will be executed in the shell  without providing the path.
ADD entry /usr/local/bin/

RUN chmod 777 /CLARKSCV1.2.6.1

RUN chmod 777 /CLARKSCV1.2.6.1/*

RUN mkdir /taxonomy

# The following folder is not versioned since it is too big.
# It is the result of clark downloading the taxonomy since LEMMI does not allow any download during the run.
# You can allow clark to download it.
# Just comment this line and edit the Taskfile to not expect anthing from there.
ADD taxonomy* /taxonomy/

RUN chmod -R 777 /taxonomy

RUN useradd -m seppey

ENTRYPOINT ["entry"]
