# Dockerfile for building a LEMMI container for metacache v0.5
# 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:18.04

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

RUN apt-get update -y
RUN apt-get install wget -y
RUN apt-get install python3 -y
RUN apt-get install python-pip -y
RUN apt-get install python3-pip -y
RUN apt-get install git -y
RUN pip install pyyaml
RUN pip install jsonschema
RUN pip install pymonad
RUN pip3 install scipy
RUN pip3 install numpy
RUN pip3 install pandas
# ...

####
#
# 2) HERE INSTALL YOUR SOFTWARE and dependencies
#
#

ENV METACACHE_DIR /metacache

RUN git clone https://github.com/muellan/metacache.git

WORKDIR $METACACHE_DIR

### If you git clone, git checkout a specific commit or tag
RUN git checkout 6c98408

# metacache build for k-mer size > 16 (requires more memory)
RUN make MACROS="-DMC_TARGET_ID_TYPE=uint32_t -DMC_WINDOW_ID_TYPE=uint32_t -DMC_KMER_TYPE=uint64_t"

WORKDIR /

ENV PATH ${PATH}:${METACACHE_DIR}/metacache


####
#
# 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
# 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 metacache can process
# and scripts that convert the metacache 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 or find | xargs
# 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.

ADD scripts/prepare_inputs.py /
ADD scripts/prepare_inputs1.sh /
ADD scripts/prepare_inputs2.sh /
ADD scripts/prepare_outputs.py /
ADD bins.header /
ADD scripts/prepare_profiles.sh /
ADD scripts/prepare_profiles.py /
ADD scripts/gunzip.sh /
ADD scripts/clean.sh /


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