# Dockerfile for building a LEMMI container, with kraken used as example
# It is based on the biobox idea, see bioboxes.org
# No validation using yaml files required here yet

### You can pick another distribution if needed, but ubuntu is a safe bet
FROM ubuntu:14.04

####
#
# 1) install the commonly required packages here
#

RUN apt-get update -y
RUN apt-get install wget -y
RUN apt-get install python -y
RUN apt-get install python-pip -y
RUN apt-get install git -y
RUN pip install pyyaml
RUN pip install jsonschema
RUN pip install pymonad
# ...

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

ENV KRAKEN_DIR /kraken

### If you git clone, git checkout a specific commit or tag, safer to guarantee the box will build in the same way when reused

RUN git clone https://github.com/DerrickWood/kraken.git $KRAKEN_DIR

WORKDIR $KRAKEN_DIR

RUN git checkout 352e780

RUN apt-get install jellyfish -y

RUN ./install_kraken.sh $KRAKEN_DIR || true

ENV PATH ${PATH}:$KRAKEN_DIR/scripts:$KRAKEN_DIR:$KRAKEN_DIR/bin

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

# do not touch this one
ADD entry /usr/local/bin/

### Modify the file, but keep it here.
ADD Taskfile /

### ADD whatever else you need here that is on your local machine in the same folder as Dockerfile
# be careful to chmod +x bash file if you call them ./script.sh
# these are scripts to convert the input fasta provided by the LEMMI bench platform into fasta that kraken can process (taxid in the header)
# and scripts that convert the kraken outputs into CAMI profiling and CAMI binning files, expected as output.
#
# To deal with the input/training content, be careful not to use command like ls, rm, that have a limited list of argument. use find -exec
# as it will have to deal with more than 100,000 files during benchmark. Try to parallelize as much as possible to use all CPU provided, as all steps will affect the runtime.
# see these example files
ADD scripts/prepare_inputs.sh /
ADD scripts/prepare_inputs.py /
ADD scripts/add_to_library.sh /
ADD scripts/prepare_results.py /

# Starting point when you call docker run analysis or docker run build_ref
# Do not change this
WORKDIR /bbx/tmp
ENTRYPOINT ["entry"]
