FROM ubuntu:latest

####
#
# 1) install the common required stuff here
#

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 python3 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!)"

####
#
# ***2) HERE INSTALL YOUR SOFTWARE.
#

ENV KRAKEN2_DIR /kraken2

RUN git clone https://github.com/DerrickWood/kraken2.git $KRAKEN2_DIR 

WORKDIR $KRAKEN2_DIR

RUN git checkout 3167304affcff626db886c42c0ad3011965697a6

RUN ./install_kraken2.sh $KRAKEN2_DIR

RUN apt-get install ncbi-blast+ -y

ENV PATH ${PATH}:$KRAKEN2_DIR/scripts:$KRAKEN2_DIR:$KRAKEN2_DIR/bin:$KRAKEN2_DIR/src

RUN cp /kraken2/src/* /kraken2/scripts

####
#
# ***3) ADD the additional files, i.e. Taskfile, entry, and any other you need
#

# You have to edit this one:
ADD Taskfile /
ADD python/denormalize.py /
# For Kraken2, these custom ones were added
# don't forget to fix the mod before, i.e. chmod +x, if you want to call ./scriptname
ADD bash/prepare_inputs.sh /
ADD bash/gunzip.sh /
ADD python/prepare_inputs.py /
ADD bash/add_to_library.sh /
ADD bash/add_and_rm.sh /
ADD bash/edit_fasta.sh /
ADD python/prepare_results.py /

# 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.
# Don't change the location of this, don't edit this file
ADD entry /usr/local/bin/

####
#
# 4) Define the entrypoint, i.e. the file that is called when the container is launched
#
# Don't touch this
#
ENTRYPOINT ["entry"]
