temp save

This commit is contained in:
mm644706215
2025-01-18 21:42:09 +08:00
parent 8d7d1e766d
commit 085ebcb84f
4 changed files with 115 additions and 182 deletions

View File

@@ -22,26 +22,13 @@ ENV SSH_PORT=2222
WORKDIR /root
SHELL ["/bin/bash", "-c"]
# Replace sources.list with Aliyun mirror
RUN <<EOT
#!/bin/bash
cp /etc/apt/sources.list /etc/apt/sources.list_bak
cat << EOF > /etc/apt/sources.list
deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
EOF
EOT
# Install base tools for compilation
RUN <<EOT
#!/bin/bash
apt update && apt install -y --no-install-recommends \
apt-get update && apt-get install -y tzdata
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "Asia/Shanghai" > /etc/timezone
apt-get install -y --no-install-recommends \
build-essential \
autotools-dev \
libaio-dev \
@@ -70,29 +57,39 @@ apt update && apt install -y --no-install-recommends \
pkg-config \
cmake \
bzip2 \
curl \
bzip2 \
tar \
curl \
wget \
jq
jq \
openssh-client \
openssh-server \
htop jq \
libgl1-mesa-glx bash-completion \
iftop iotop ca-certificates
pip install pipx
pipx install nvitop
pipx ensurepath
. ~/.bashrc
EOT
RUN echo "Check wget version" && wget --version
# Install Modules for environment management
COPY ./file/modules-5.4.0.tar.gz /root
# SSH setup
RUN <<EOT
#!/bin/bash
tar zxvf modules-5.4.0.tar.gz
cd modules-5.4.0
./configure --prefix=/opt/modules --bindir=/opt/modules/bin --libdir=/opt/modules/lib --disable-libtclenvmodules
make -j$(nproc)
make install
echo "source /opt/modules/init/profile.sh" >> /etc/profile
echo "source /opt/modules/init/profile.sh" >> ~/.bashrc
mkdir ~/.ssh
printf "Host * \n ForwardAgent yes\nHost *\n StrictHostKeyChecking no" > ~/.ssh/config
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/^\(\s*\)GSSAPIAuthentication yes/\1GSSAPIAuthentication no/' /etc/ssh/ssh_config
sed -i "s/^#Port 22/Port ${SSH_PORT}/" /etc/ssh/sshd_config
ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa -N "" <<< y
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
mkdir /var/run/sshd
echo "root:${ROOT_PASSWD}" | chpasswd
EOT
# Install FFTW
@@ -192,14 +189,6 @@ make install
echo "source /usr/local/gromacs-${GROMACS_VERSION}-plumed-${PLUMED_VERSION}/bin/GMXRC.bash" >> /root/.bashrc
EOT
# Install AmberTools and Amber
COPY file/Amber24.tar.bz2 file/AmberTools24.tar.bz2 /root
RUN <<EOT
#!/bin/bash
tar -xjvf Amber24.tar.bz2
tar -xjvf AmberTools24.tar.bz2
EOT
# Install Boost
COPY file/boost_1_86_0.tar.gz /root
ENV MODULEPATH=/opt/modulefiles/boost:$MODULEPATH
@@ -233,32 +222,6 @@ echo "source /opt/intel/setvars.sh" >> ~/.bashrc
echo "source /opt/intel/onemkl/setvars.sh" >> ~/.bashrc
EOT
# SSH setup
RUN <<EOT
#!/bin/bash
mkdir ~/.ssh
printf "Host * \n ForwardAgent yes\nHost *\n StrictHostKeyChecking no" > ~/.ssh/config
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/^\(\s*\)GSSAPIAuthentication yes/\1GSSAPIAuthentication no/' /etc/ssh/ssh_config
sed -i "s/^#Port 22/Port ${SSH_PORT}/" /etc/ssh/sshd_config
ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa -N "" <<< y
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
mkdir /var/run/sshd
echo "root:${ROOT_PASSWD}" | chpasswd
EOT
# Timezone setup
RUN <<EOT
#!/bin/bash
apt-get install -y tzdata
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "Asia/Shanghai" > /etc/timezone
EOT
# Install micromamba silently
WORKDIR /root
ENV BIN_FOLDER=/usr/local/bin
@@ -284,6 +247,16 @@ RUN <<EOT
git clone https://github.com/luancarvalhomartins/PyAutoFEP.git
EOT
# Install AmberTools and Amber
COPY file/Amber24.tar.bz2 file/AmberTools24.tar.bz2 /root
RUN <<EOT
#!/bin/bash
tar -xjvf Amber24.tar.bz2
tar -xjvf AmberTools24.tar.bz2
EOT
# install mmgbsa
# Final cleanup
RUN <<EOT
#!/bin/bash
@@ -313,8 +286,8 @@ COPY --from=build-env /usr/local/ucx /usr/local/ucx
COPY --from=build-env /usr/local/openmpi /usr/local/openmpi
COPY --from=build-env /usr/local/plumed /usr/local/plumed
COPY --from=build-env /usr/local/gromacs-${GROMACS_VERSION}-plumed-${PLUMED_VERSION} /usr/local/gromacs-${GROMACS_VERSION}-plumed-${PLUMED_VERSION}
COPY --from=build-env /opt/micromamba /opt/micromamba
COPY --from=build-env /usr/local/bin/micromamba /usr/local/bin/micromamba
COPY --from=build-env /opt /opt
COPY --from=build-env /usr/local/bin /usr/local/bin
COPY --from=build-env /root/.bashrc /root/.bashrc
# COPY --from=build-env /root/.condarc /root/.condarc # Copy micromamba config file
# COPY --from=build-env /root/.mambarc /root/.mambarc # Copy micromamba config file (if exists)
@@ -323,12 +296,39 @@ COPY --from=build-env /opt/intel/onemkl /opt/intel/onemkl
COPY --from=build-env /opt/boost /opt/boost
COPY --from=build-env /opt/modulefiles /opt/modulefiles
COPY --from=build-env /root/.ssh /root/.ssh
# COPY --from=build-env /etc/ssh/sshd_config /etc/ssh/sshd_config
COPY --from=build-env /etc/ssh/sshd_config /etc/ssh/sshd_config
COPY --from=build-env /var/run/sshd /var/run/sshd
COPY --from=build-env /root/.local /root/.local
# Set up micromamba environment
RUN <<EOT
#!/bin/bash
apt update && apt install -y --no-install-recommends tcl-dev \
gcc \
grep \
environment-modules \
tcl-devel \
vim \
bzip2 \
tar \
curl \
wget \
jq \
openssh-client \
openssh-server \
htop jq \
libgl1-mesa-glx bash-completion \
iftop iotop ca-certificates
mkdir -p ~/.local/modules
sudo apt install environment-modules tcl-devel
export HTTPS_PROXY="http://127.0.0.1:20171"
export HTTP_PROXY="http://127.0.0.1:20171"
wget https://sourceforge.net/projects/modules/files/Modules/modules-5.5.0/modules-5.5.0.tar.gz/download
curl -LJO https://github.com/cea-hpc/modules/releases/download/v5.5.0/modules-5.5.0.tar.gz
tar xfz modules-5.5.0.tar.gz
./configure --prefix=$HOME/.local/modules --with-tcl-lib=/usr/local/tools/tcl/lib --with-tcl-inc=/usr/local/tools/tcl/include --modulefilesdir=$HOME/.local/modules/modulefiles
make
make install
# Add micromamba to PATH
echo 'export PATH=/usr/local/bin:$PATH' >> /root/.bashrc
# Initialize micromamba for bash
@@ -359,5 +359,5 @@ EOF
EOT
# SSH setup
EXPOSE ${SSH_PORT}
# EXPOSE ${SSH_PORT}
CMD ["/usr/sbin/sshd", "-D"]

View File

@@ -41,7 +41,10 @@ EOT
# Install base tools for compilation
RUN <<EOT
#!/bin/bash
apt update && apt install -y --no-install-recommends \
apt-get update && apt-get install -y tzdata
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "Asia/Shanghai" > /etc/timezone
apt-get install -y --no-install-recommends \
build-essential \
autotools-dev \
libaio-dev \
@@ -70,17 +73,40 @@ apt update && apt install -y --no-install-recommends \
pkg-config \
cmake \
bzip2 \
curl \
bzip2 \
tar \
curl \
wget \
jq
jq \
openssh-client \
openssh-server \
htop jq \
libgl1-mesa-glx bash-completion \
iftop iotop ca-certificates
pip install pipx
pipx install nvitop
pipx ensurepath
. ~/.bashrc
EOT
RUN echo "Check wget version" && wget --version
# SSH setup
RUN <<EOT
#!/bin/bash
mkdir ~/.ssh
printf "Host * \n ForwardAgent yes\nHost *\n StrictHostKeyChecking no" > ~/.ssh/config
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/^\(\s*\)GSSAPIAuthentication yes/\1GSSAPIAuthentication no/' /etc/ssh/ssh_config
sed -i "s/^#Port 22/Port ${SSH_PORT}/" /etc/ssh/sshd_config
ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa -N "" <<< y
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
mkdir /var/run/sshd
echo "root:${ROOT_PASSWD}" | chpasswd
EOT
# Install Modules for environment management
COPY ./file/modules-5.4.0.tar.gz /root
@@ -192,14 +218,6 @@ make install
echo "source /usr/local/gromacs-${GROMACS_VERSION}-plumed-${PLUMED_VERSION}/bin/GMXRC.bash" >> /root/.bashrc
EOT
# Install AmberTools and Amber
COPY file/Amber24.tar.bz2 file/AmberTools24.tar.bz2 /root
RUN <<EOT
#!/bin/bash
tar -xjvf Amber24.tar.bz2
tar -xjvf AmberTools24.tar.bz2
EOT
# Install Boost
COPY file/boost_1_86_0.tar.gz /root
ENV MODULEPATH=/opt/modulefiles/boost:$MODULEPATH
@@ -233,32 +251,6 @@ echo "source /opt/intel/setvars.sh" >> ~/.bashrc
echo "source /opt/intel/onemkl/setvars.sh" >> ~/.bashrc
EOT
# SSH setup
RUN <<EOT
#!/bin/bash
mkdir ~/.ssh
printf "Host * \n ForwardAgent yes\nHost *\n StrictHostKeyChecking no" > ~/.ssh/config
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/^\(\s*\)GSSAPIAuthentication yes/\1GSSAPIAuthentication no/' /etc/ssh/ssh_config
sed -i "s/^#Port 22/Port ${SSH_PORT}/" /etc/ssh/sshd_config
ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa -N "" <<< y
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
mkdir /var/run/sshd
echo "root:${ROOT_PASSWD}" | chpasswd
EOT
# Timezone setup
RUN <<EOT
#!/bin/bash
apt-get install -y tzdata
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "Asia/Shanghai" > /etc/timezone
EOT
# Install micromamba silently
WORKDIR /root
ENV BIN_FOLDER=/usr/local/bin
@@ -284,6 +276,16 @@ RUN <<EOT
git clone https://github.com/luancarvalhomartins/PyAutoFEP.git
EOT
# Install AmberTools and Amber
COPY file/Amber24.tar.bz2 file/AmberTools24.tar.bz2 /root
RUN <<EOT
#!/bin/bash
tar -xjvf Amber24.tar.bz2
tar -xjvf AmberTools24.tar.bz2
EOT
# install mmgbsa
# Final cleanup
RUN <<EOT
#!/bin/bash
@@ -291,73 +293,4 @@ apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
rm -rf /root/modules-5.4.0 /root/fftw-${FFTW_VERSION} /root/ucx /root/ompi /root/plumed-${PLUMED_VERSION} /root/gromacs-${GROMACS_VERSION}
rm -rf /root/Amber24.tar.bz2 /root/AmberTools24.tar.bz2 /root/boost_1_86_0.tar.gz
EOT
# Stage 2: Runtime image
# FROM nvidia/cuda:${TAG_VERSION}
# ENV CUDA_HOME=/usr/local/cuda
# ENV PATH=$CUDA_HOME/bin:$PATH
# ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:/usr/local/plumed/lib:$LD_LIBRARY_PATH
# ENV CPATH=$CUDA_HOME/include:$CPATH
# ENV LIBRARY_PATH=$CUDA_HOME/lib64:$LIBRARY_PATH
# ARG SSH_PORT=2222
# WORKDIR /root
# SHELL ["/bin/bash", "-c"]
# ARG GROMACS_VERSION="2021.7"
# ARG PLUMED_VERSION="2.9.2"
# # Copy necessary files from build stage
# COPY --from=build-env /usr/local/fftw /usr/local/fftw
# COPY --from=build-env /usr/local/ucx /usr/local/ucx
# COPY --from=build-env /usr/local/openmpi /usr/local/openmpi
# COPY --from=build-env /usr/local/plumed /usr/local/plumed
# COPY --from=build-env /usr/local/gromacs-${GROMACS_VERSION}-plumed-${PLUMED_VERSION} /usr/local/gromacs-${GROMACS_VERSION}-plumed-${PLUMED_VERSION}
# COPY --from=build-env /opt/micromamba /opt/micromamba
# COPY --from=build-env /usr/local/bin/micromamba /usr/local/bin/micromamba
# COPY --from=build-env /root/.bashrc /root/.bashrc
# # COPY --from=build-env /root/.condarc /root/.condarc # Copy micromamba config file
# # COPY --from=build-env /root/.mambarc /root/.mambarc # Copy micromamba config file (if exists)
# COPY --from=build-env /opt/intel /opt/intel
# COPY --from=build-env /opt/intel/onemkl /opt/intel/onemkl
# COPY --from=build-env /opt/boost /opt/boost
# COPY --from=build-env /opt/modulefiles /opt/modulefiles
# COPY --from=build-env /root/.ssh /root/.ssh
# # COPY --from=build-env /etc/ssh/sshd_config /etc/ssh/sshd_config
# COPY --from=build-env /var/run/sshd /var/run/sshd
# # Set up micromamba environment
# RUN <<EOT
# #!/bin/bash
# # Add micromamba to PATH
# echo 'export PATH=/usr/local/bin:$PATH' >> /root/.bashrc
# # Initialize micromamba for bash
# eval "$(micromamba shell hook --shell )"
# /usr/local/bin/micromamba shell init --shell=bash --root-prefix=/opt/micromamba
# # Activate micromamba
# source /root/.bashrc
# micromamba self-update
# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/
# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
# micromamba config append channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/
# micromamba config append channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/
# # Activate the PyAutoFEP environment
# micromamba activate PyAutoFEP
# mkdir -p ~/.pip
# cat << EOF > ~/.pip/pip.conf
# [global]
# index-url = https://mirrors.aliyun.com/pypi/simple/
# [install]
# trusted-host=mirrors.aliyun.com
# EOF
# EOT
# SSH setup
EXPOSE ${SSH_PORT}
CMD ["/usr/sbin/sshd", "-D"]
EOT

View File

@@ -14,8 +14,8 @@ services:
BUILDKIT_INLINE_CACHE: 1
# env_file:
# - .env
volumes:
- ./data:/data
# volumes:
# - ./data:/data
container_name: gromacs_amber_stage
pull_policy: if_not_present
ulimits:
@@ -33,8 +33,8 @@ services:
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
- TMPDIR=/var/tmp
ports:
- "53322:2222"
# ports:
# - "53322:2222"
# network_mode: host
# command: ["/usr/sbin/sshd", "-D"]
command: ["tail", "-f", "/dev/null"]

View File

@@ -14,8 +14,8 @@ services:
BUILDKIT_INLINE_CACHE: 1
# env_file:
# - .env
volumes:
- ./data:/data
# volumes:
# - ./data:/data
container_name: gromacs_amber_staget
pull_policy: if_not_present
ulimits:
@@ -33,8 +33,8 @@ services:
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
- TMPDIR=/var/tmp
ports:
- "53322:2222"
# ports:
# - "53322:2222"
# network_mode: host
# command: ["/usr/sbin/sshd", "-D"]
command: ["tail", "-f", "/dev/null"]