# lncnova: every tool and every reference database in one image.
FROM mambaorg/micromamba:1.5.10

USER root
RUN micromamba install -y -n base -c conda-forge -c bioconda \
        python=3.11 pip curl fastp hisat2 stringtie gffcompare gffread samtools subread cpc2 cpat intarna=3.4.1 \
    && micromamba clean -a -y
ENV PATH=/opt/conda/bin:$PATH \
    LNCNOVA_DATA=/opt/lncnova/data \
    LNCNOVA_IN_CONTAINER=1

# Python dependencies (needed by the data-preparation step below)
RUN pip install --no-cache-dir numpy pandas scipy openpyxl pysam "pydeseq2>=0.4"

# Reference data (large, cached layer: changes to the source below do not re-download it)
ARG THREADS=8
COPY docker/fetch_data.sh /tmp/fetch_data.sh
RUN mkdir -p /opt/lncnova && THREADS=${THREADS} /tmp/fetch_data.sh && rm /tmp/fetch_data.sh

COPY pyproject.toml README.md LICENSE.txt /src/
COPY src /src/src
RUN pip install --no-cache-dir --no-deps /src && rm -rf /src

RUN chmod -R a+rX /opt/lncnova
RUN mkdir -p /work && chmod 1777 /work
WORKDIR /work
ENTRYPOINT []
CMD ["lncnova", "--help"]
