1.利用ssh工具登录pilogin节点或者sylogin节点
2.利用ssh工具登录container-x86节点
ssh build@container-x86
3.编辑siyuan1.DockerFile文件,文件内容如下
# siyuan1.DockerFile centos:8
FROM centos:8
RUN mkdir -pv /opt/etc/ && \
touch /opt/etc/bashrc && \
echo "export https_proxy=http://proxy.pi.sjtu.edu.cn:3004/ " >> /opt/etc/bashrc && \
echo "export http_proxy=http://proxy.pi.sjtu.edu.cn:3004/ " >> /opt/etc/bashrc && \
echo "export no_proxy=puppet " >> /opt/etc/bashrc
# set mirrors
RUN source /opt/etc/bashrc && \
sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-* && \
sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-* && \
yum clean all && yum makecache
# https://mirrors.tuna.tsinghua.edu.cn/centos http://vault.centos.org
# RUN yum install -y \
# curl
# RUN curl https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo > /etc/yum.repos.d/Centos-vault-8.5.2111.repo && \
# curl https://mirrors.aliyun.com/repo/epel-archive-8.repo > /etc/yum.repos.d/epel-archive-8.repo && \
# yum clean all && yum makecache
RUN source /opt/etc/bashrc && \
yum update -y && \
rm -rf /var/cache/yum/*
RUN source /opt/etc/bashrc && \
yum install -y \
tree \
vim \
git \
bzip2 \
wget && \
rm -rf /var/cache/yum/*
RUN echo "basic tools completed !! "
RUN source /opt/etc/bashrc && \
yum install -y \
mesa-libGLU \
libXrender \
libXcursor \
libXft \
libXinerama \
libgomp \
&& \
rm -rf /var/cache/yum/*
RUN echo "gmsh basic libs completed !! "
RUN source /opt/etc/bashrc && \
mkdir -p opt/GMSH/ && \
cd opt/GMSH/ && \
wget --no-check-certificate http://www.gmsh.info/bin/Linux/gmsh-4.4.0-Linux64.tgz && \
tar -xzvf gmsh-4.4.0-Linux64.tgz && \
rm -rvf gmsh-4.4.0-Linux64.tgz && \
echo "export PATH='$PATH':/opt/GMSH/gmsh-4.4.0-Linux64/bin " >> /etc/bashrc
RUN echo "gmsh 4.4.0 completed !! "
RUN source /opt/etc/bashrc && \
yum install -y \
epel-release \
cmake3 \
make \
patch \
flex \
bison \
zlib-devel \
boost-system \
boost-thread \
readline-devel \
ncurses-devel \
gcc-c++ \
gcc \
openmpi \
openmpi-devel \
boost \
openssl && \
rm -rf /var/cache/yum/*
RUN echo "OpenFOAM tools completed !! "
RUN echo "192.30.255.113 github.com" >> /etc/hosts
RUN echo "export PATH='$PATH':/usr/lib64/openmpi/bin:/usr/lib64/openmpi/bin/mpicc " >> /etc/bashrc
RUN source /opt/etc/bashrc && \
mkdir -p /opt && \
export BUILD_DIR=/opt/OpenFOAM && \
mkdir -p $BUILD_DIR && \
cd $BUILD_DIR && \
git clone https://gitee.com/xinxinzhou1995/OpenFOAM-4.x.git && \
git clone https://gitee.com/xinxinzhou1995/ThirdParty-4.x.git
RUN echo "OpenFOAM 4.x download completed !!"
RUN source /opt/etc/bashrc && \
echo "export OF40='source /opt/OpenFOAM/OpenFOAM-4.x/etc/bashrc ' " >> /etc/bashrc && \
cd /opt/OpenFOAM/OpenFOAM-4.x && \
ncount=$(grep -n 'export FOAM_INST_DIR=\$HOME/\$WM_PROJECT' etc/bashrc | cut -f1 --delimiter=':') && \
sed -i "${ncount}d" etc/bashrc && \
ncount=$((${ncount}-1)) && \
sed -i "${ncount}a export FOAM_INST_DIR=/opt/\$WM_PROJECT" etc/bashrc && \
source /etc/bashrc && \
${OF40} # &&
# ./Allwmake -j
# RUN echo "OpenFOAM 4.x make completed !! "
RUN source /opt/etc/bashrc && \
mkdir -p /opt && \
export BUILD_DIR=/opt/OpenFOAM && \
mkdir -p $BUILD_DIR && \
cd $BUILD_DIR && \
git clone https://gitee.com/Allenxcw/OpenFOAM-5.x.git && \
git clone https://gitee.com/Allenxcw/ThirdParty-5.x.git
RUN echo "OpenFOAM 5.x download completed !!"
RUN source /opt/etc/bashrc && \
echo "export OF50='source /opt/OpenFOAM/OpenFOAM-5.x/etc/bashrc ' " >> /etc/bashrc && \
cd /opt/OpenFOAM/OpenFOAM-5.x && \
ncount=$(grep -n 'export FOAM_INST_DIR=\$HOME/\$WM_PROJECT' etc/bashrc | cut -f1 --delimiter=':') && \
sed -i "${ncount}d" etc/bashrc && \
ncount=$((${ncount}-1)) && \
sed -i "${ncount}a export FOAM_INST_DIR=/opt/\$WM_PROJECT" etc/bashrc && \
source /etc/bashrc && \
${OF50} && \
./Allwmake -j
RUN echo "OpenFOAM 5.x make completed !! "
RUN source /opt/etc/bashrc && \
mkdir -p /opt && \
export BUILD_DIR=/opt/OpenFOAM && \
mkdir -p $BUILD_DIR && \
cd $BUILD_DIR && \
git clone https://gitee.com/diyboy/OpenFOAM-6.git && \
git clone https://gitee.com/diyboy/ThirdParty-6.git
RUN echo "OpenFOAM 6.0 download completed !!"
RUN source /opt/etc/bashrc && \
echo "export OF60='source /opt/OpenFOAM/OpenFOAM-6/etc/bashrc ' " >> /etc/bashrc && \
cd /opt/OpenFOAM/OpenFOAM-6 && \
ncount=$(grep -n 'export FOAM_INST_DIR=\$HOME/\$WM_PROJECT' etc/bashrc | cut -f1 --delimiter=':') && \
sed -i "${ncount}d" etc/bashrc && \
ncount=$((${ncount}-1)) && \
sed -i "${ncount}a export FOAM_INST_DIR=/opt/\$WM_PROJECT" etc/bashrc && \
source /etc/bashrc && \
${OF60} && \
./Allwmake -j
RUN echo "OpenFOAM 6.0 make completed !! "
RUN source /opt/etc/bashrc && \
mkdir -p /opt && \
export BUILD_DIR=/opt/OpenFOAM && \
mkdir -p $BUILD_DIR && \
cd $BUILD_DIR && \
git clone https://gitee.com/zhouxu2012/OpenFOAM-7.git && \
git clone https://gitee.com/zhouxu2012/ThirdParty-7.git
RUN echo "OpenFOAM 7.0 download completed !!"
RUN source /opt/etc/bashrc && \
echo "export OF70='source /opt/OpenFOAM/OpenFOAM-7/etc/bashrc ' " >> /etc/bashrc && \
cd /opt/OpenFOAM/OpenFOAM-7 && \
ncount=$(grep -n 'export FOAM_INST_DIR=\$HOME/\$WM_PROJECT' etc/bashrc | cut -f1 --delimiter=':') && \
sed -i "${ncount}d" etc/bashrc && \
ncount=$((${ncount}-1)) && \
sed -i "${ncount}a export FOAM_INST_DIR=/opt/\$WM_PROJECT" etc/bashrc && \
source /etc/bashrc && \
${OF70} && \
./Allwmake -j
RUN echo "OpenFOAM 7.0 make completed !! "
RUN source /opt/etc/bashrc && \
mkdir -p /opt && \
export BUILD_DIR=/opt/OpenFOAM && \
mkdir -p $BUILD_DIR && \
cd $BUILD_DIR && \
git clone https://gitee.com/zzw0799/OpenFOAM-8.git && \
git clone https://gitee.com/zzw0799/ThirdParty-8.git
RUN echo "OpenFOAM 8.0 download completed !!"
RUN source /opt/etc/bashrc && \
echo "export OF80='source /opt/OpenFOAM/OpenFOAM-8/etc/bashrc ' " >> /etc/bashrc && \
cd /opt/OpenFOAM/OpenFOAM-8 && \
ncount=$(grep -n 'export FOAM_INST_DIR=\$HOME/\$WM_PROJECT' etc/bashrc | cut -f1 --delimiter=':') && \
sed -i "${ncount}d" etc/bashrc && \
ncount=$((${ncount}-1)) && \
sed -i "${ncount}a export FOAM_INST_DIR=/opt/\$WM_PROJECT" etc/bashrc && \
source /etc/bashrc && \
${OF80} && \
./Allwmake -j
RUN echo "OpenFOAM 8.0 make completed !! "
RUN source /opt/etc/bashrc && \
mkdir -p /opt && \
export BUILD_DIR=/opt/OpenFOAM && \
mkdir -p $BUILD_DIR && \
cd $BUILD_DIR && \
git clone https://gitee.com/cjthermo/OpenFOAM-9.git && \
git clone https://gitee.com/cjthermo/ThirdParty-9.git
RUN echo "OpenFOAM 9.0 download completed !!"
RUN source /opt/etc/bashrc && \
echo "export OF90='source /opt/OpenFOAM/OpenFOAM-9/etc/bashrc ' " >> /etc/bashrc && \
cd /opt/OpenFOAM/OpenFOAM-9 && \
ncount=$(grep -n 'export FOAM_INST_DIR=\$HOME/\$WM_PROJECT' etc/bashrc | cut -f1 --delimiter=':') && \
sed -i "${ncount}d" etc/bashrc && \
ncount=$((${ncount}-1)) && \
sed -i "${ncount}a export FOAM_INST_DIR=/opt/\$WM_PROJECT" etc/bashrc && \
source /etc/bashrc && \
${OF90} && \
./Allwmake -j
RUN echo "OpenFOAM 9.0 make completed !! "
RUN source /opt/etc/bashrc && \
cd /opt/OpenFOAM/ && \
WM_PROJECT_VERSION=v1906 && \
wget --no-check-certificate https://sourceforge.net/projects/openfoam/files/${WM_PROJECT_VERSION}/OpenFOAM-${WM_PROJECT_VERSION}.tgz && \
wget --no-check-certificate https://sourceforge.net/projects/openfoam/files/${WM_PROJECT_VERSION}/ThirdParty-${WM_PROJECT_VERSION}.tgz && \
tar -xzvf OpenFOAM-${WM_PROJECT_VERSION}.tgz && \
rm -rvf OpenFOAM-${WM_PROJECT_VERSION}.tgz && \
tar -xzvf ThirdParty-${WM_PROJECT_VERSION}.tgz && \
rm -rvf ThirdParty-${WM_PROJECT_VERSION}.tgz && \
echo "OpenFOAM "${WM_PROJECT_VERSION}" download completed !!" && \
echo "export OF"${WM_PROJECT_VERSION}"='source /opt/OpenFOAM/OpenFOAM-"${WM_PROJECT_VERSION}"/etc/bashrc ' " >> /etc/bashrc && \
cd /opt/OpenFOAM/OpenFOAM-${WM_PROJECT_VERSION}/ && \
ncount=$(grep -n 'projectDir=\"\$HOME/OpenFOAM/OpenFOAM-\$WM_PROJECT_VERSION\"' etc/bashrc | cut -f1 --delimiter=':') && \
sed -i "${ncount}d" etc/bashrc && \
ncount=$((${ncount}-1)) && \
sed -i ${ncount}'a projectDir="/opt/openfoam/OpenFOAM-\$WM_PROJECT_VERSION"' etc/bashrc && \
source /etc/bashrc && \
${OFv1906} && \
./Allwmake -j && \
echo "OpenFOAM "${WM_PROJECT_VERSION}" make completed !! "
RUN source /opt/etc/bashrc && \
cd /opt/OpenFOAM/ && \
WM_PROJECT_VERSION=v2106 && \
wget --no-check-certificate https://sourceforge.net/projects/openfoam/files/${WM_PROJECT_VERSION}/OpenFOAM-${WM_PROJECT_VERSION}.tgz && \
wget --no-check-certificate https://sourceforge.net/projects/openfoam/files/${WM_PROJECT_VERSION}/ThirdParty-${WM_PROJECT_VERSION}.tgz && \
tar -xzvf OpenFOAM-${WM_PROJECT_VERSION}.tgz && \
rm -rvf OpenFOAM-${WM_PROJECT_VERSION}.tgz && \
tar -xzvf ThirdParty-${WM_PROJECT_VERSION}.tgz && \
rm -rvf ThirdParty-${WM_PROJECT_VERSION}.tgz && \
echo "OpenFOAM "${WM_PROJECT_VERSION}" download completed !!" && \
echo "export OF"${WM_PROJECT_VERSION}"='source /opt/OpenFOAM/OpenFOAM-"${WM_PROJECT_VERSION}"/etc/bashrc ' " >> /etc/bashrc && \
cd /opt/OpenFOAM/OpenFOAM-${WM_PROJECT_VERSION}/ && \
ncount=$(grep -n 'projectDir=\"\$HOME/OpenFOAM/OpenFOAM-\$WM_PROJECT_VERSION\"' etc/bashrc | cut -f1 --delimiter=':') && \
sed -i "${ncount}d" etc/bashrc && \
ncount=$((${ncount}-1)) && \
sed -i ${ncount}'a projectDir="/opt/openfoam/OpenFOAM-\$WM_PROJECT_VERSION"' etc/bashrc && \
source /etc/bashrc && \
${OFv2106} && \
./Allwmake -j && \
echo "OpenFOAM "${WM_PROJECT_VERSION}" make completed !! "
4.制作docker容器
docker build -f ./siyuan1.DockerFile -t siyuan1 .
5.将docker容器转换成singularity容器
singularity build --force siyuan1.sif docker-daemon://siyuan1:latest
6.将生成的sif文件传输到超算数据节点上
scp -rv -o StrictHostKeyChecking=no ./siyuan1.sif naoxb@data.hpc.sjtu.edu.cn:~/sif-file/siyuan1-latest.sif
scp -rv -o StrictHostKeyChecking=no ./siyuan1.sif naoxb@sydata.hpc.sjtu.edu.cn:~/sif-file/siyuan1-latest.sif
后记
和博客
https://blog.youkuaiyun.com/joshua_shi_t/article/details/124604379
939

被折叠的 条评论
为什么被折叠?



