FROM image.sourcefind.cn:5000/dcu/admin/base/jax:0.4.23-ubuntu20.04-dtk24.04.1-py3.10

RUN apt update

RUN sudo apt install hmmer -y

RUN sudo apt install doxygen -y

WORKDIR /app

COPY . /app/alphafold2

# hh-suite

WORKDIR /app/softwares

RUN git clone https://github.com/soedinglab/hh-suite.git

# # for intel cpu
# RUN mkdir -p hh-suite/build && cd hh-suite/build && lscpu | grep 'Model name' | grep -q 'Intel' && cmake -DCMAKE_INSTALL_PREFIX=. .. && make -j 4 && make install || echo "not for intel"

# # RUN which hhsearch && echo "already build for intel" || echo ""

# # for others
# RUN lscpu | grep 'Model name' | grep -vq 'Intel' && cmake -DHAVE_AVX2=1 -DCMAKE_INSTALL_PREFIX=. .. && make -j 4 && make install && echo "already build for hygon or amd" || echo "not for others"

# # RUN which hhsearch

# ENV PATH=/app/softwares/hh-suite/build/bin:/app/softwares/hh-suite/build/scripts:$PATH

# RUN which hhsearch

# kalign

WORKDIR /app/softwares

RUN wget https://github.com/TimoLassmann/kalign/archive/refs/tags/v3.4.0.zip && unzip v3.4.0.zip && cd kalign-3.4.0 && mkdir build && cd build && cmake .. && make && sudo make install

# openmm

WORKDIR /app/softwares

RUN wget https://github.com/openmm/openmm/archive/refs/tags/8.0.0.zip && unzip 8.0.0.zip

# RUN mkdir build build-hip install

# RUN cd build && cmake ../openmm-8.0.0/ -D CMAKE_INSTALL_PREFIX=../install -D OPENMM_BUILD_COMMON=ON -D OPENMM_PYTHON_USER_INSTALL=ON && make && sudo make install && sudo make PythonInstall

# hip
WORKDIR /app/softwares

RUN git clone https://github.com/amd/openmm-hip.git

# RUN cd build-hip && cmake ../openmm-hip/ -D OPENMM_DIR=../install -D OPENMM_SOURCE_DIR=../openmm-8.0.0 -D CMAKE_INSTALL_PREFIX=../install && make && sudo make install

# ENV LD_LIBRARY_PATH=/app/softwares/build-hip/:$LD_LIBRARY_PATH

# ENV OPENMM_PLUGIN_DIR=/app/softwares/install/lib/plugins

# ENV OPENMM_FFT_BACKEND=1

# RUN python docker_test.py | grep -q 'HIP'

# pdbfixer

WORKDIR /app/softwares

RUN wget https://github.com/openmm/pdbfixer/archive/refs/tags/1.9.zip && unzip 1.9.zip && cd pdbfixer-1.9 && python setup.py install 

# pip
RUN ls

RUN pip install --no-cache-dir -r /app/alphafold2/requirements_dcu.txt -i https://mirrors.ustc.edu.cn/pypi/web/simple

RUN pip install dm-haiku==0.0.11 flax==0.7.1 jmp==0.0.2 tabulate==0.8.9 --no-deps jax -i https://mirrors.ustc.edu.cn/pypi/web/simple

RUN pip install orbax==0.1.6 orbax-checkpoint==0.1.6 optax==0.2.2 -i https://mirrors.ustc.edu.cn/pypi/web/simple

WORKDIR /app/alphafold2

RUN python setup.py install
