FROM arm64v8/ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update --quiet \
    && apt-get install --yes --quiet --no-install-recommends wget

RUN wget "https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py310_22.11.1-1-Linux-aarch64.sh" --no-check-certificate \
    && bash Miniconda3-py310_22.11.1-1-Linux-aarch64.sh -b -p /app/miniconda \
    && rm Miniconda3-py310_22.11.1-1-Linux-aarch64.sh \
    && apt-get remove -y wget \
    && apt-get autoremove -y \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /app/JanusX
COPY . .
ENV PATH="/app/JanusX:/app/miniconda/bin:$PATH"

RUN pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple \
    && pip install pyblup==1.0.5 gfreader==1.0.5 bioplotkit \
    && /app/miniconda/bin/conda clean -afy \
    && python -m pip cache purge \
    && mv doc/docker.sh gtools && chmod +x ./gtools \
    && ./jx gwas -h

ENTRYPOINT ["jx"]