-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from qingfengxia/dev
Dockerfile for centos8 with docker iamge ppp-centos uploaded to dockerhub
- Loading branch information
Showing
5 changed files
with
169 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# command to build: docker build --rm -f Dockerfile_centos -t qingfengxia/ppp-centos . --no-cache | ||
# docker push qingfengxia/ppp-centos:latest | ||
# Use multi-stage builds: https://docs.docker.com/develop/develop-images/multistage-build/ | ||
# rebuild on top of local image (instead of base OS layer) for quick modification, run without `--rm` | ||
# docker build -f Dockerfile_centos -t qingfengxia/ppp-centos . | ||
|
||
# Base OS layer: | ||
FROM centos:8 | ||
|
||
LABEL name="ppp-centos" \ | ||
maintainer="qingfeng.xia @ UKAEA" \ | ||
version="0.3" \ | ||
description="parallel with OpenCASCADE" | ||
|
||
#USER root | ||
|
||
# avoid interactive timezone selection, ENV setting will affect child image | ||
# ENV TZ=Europe/London | ||
# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
# using yum command -y | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# centos-release-scl is only needed for cento 7.6 or lower | ||
# yum install epel-release centos-release-scl -y | ||
# the default cmake version is too low 2.8 for centos7 | ||
|
||
# you must update before any yum install or add a repo | ||
# dnf group install "Development Tools" -y | ||
RUN yum install epel-release -y && yum update -y && dnf groupinstall "Development Tools" -y \ | ||
&& yum install wget cmake git python3 python3-devel -y | ||
|
||
|
||
RUN yum install tbb tbb-devel freetype freetype-devel fontconfig-devel freeimage freeimage-devel -y | ||
|
||
# for OpenCASCADE, openGL is needed for BUILD_MODULE_Visualization, and TKService | ||
RUN yum install libXmu-devel libX11-devel libXi-devel -y | ||
|
||
# install those below if Draw module is enabled for building OpenCASCADE | ||
# yum install tk tcl tk-devel tcl-devel -y | ||
|
||
# these packages SDL2_image-devel name maybe centos7, or needed by centos7 only | ||
RUN if test $(awk '/VERSION_ID=/' /etc/*-release | sed 's/VERSION_ID=//' | sed 's/\"//' | sed 's/\"$//' ) = "7" ; then \ | ||
yum install SDL2-devel glew-devel glm-devel -y; \ | ||
fi | ||
|
||
# centos8 install fron non-official repo | ||
RUN if test $(awk '/VERSION_ID=/' /etc/*-release | sed 's/VERSION_ID=//' | sed 's/\"//' | sed 's/\"$//' ) = "8" ; then \ | ||
dnf --enablerepo=PowerTools install glew-devel glm-devel SDL2-devel -y; \ | ||
fi | ||
|
||
# install OpenCASCADE from official readonly repo is not working, it needs to upload ssh pubkey | ||
# https://old.opencascade.com/doc/occt-7.0.0/overview/html/occt_dev_guides__git_guide.html | ||
# git clone -b V7_4_0p1 [email protected]:occt occt | ||
|
||
RUN cd $HOME && wget "http://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=V7_4_0p1;sf=tgz" -O occt.tar.gz && \ | ||
tar -xzf occt.tar.gz | ||
|
||
RUN cd $HOME && cd occt-* && \ | ||
mkdir build && cd build && \ | ||
cmake .. -DUSE_TBB=ON -DBUILD_MODULE_Draw=OFF -DBUILD_MODULE_Visualization=OFF && \ | ||
make -j$(nproc) && \ | ||
make install && \ | ||
cd .. && rm -rf build | ||
|
||
|
||
ENV DISPLAY :0 | ||
|
||
|
||
RUN cd $HOME && git clone https://github.com/ukaea/parallel-preprocessor.git && \ | ||
cd parallel-preprocessor && git submodule update --init --recursive && \ | ||
mkdir build && cd build && \ | ||
dnf install which -y && \ | ||
cmake .. -DPYTHON_EXECUTABLE=$(which python3) -DCMAKE_BUILD_TYPE=Release && \ | ||
make -j$(nproc) && \ | ||
make install && \ | ||
cd .. && rm -rf build | ||
|
||
# pppGeomPipeline: error while loading shared libraries: libpppGeom.so: cannot open shared object file: No such file or directory | ||
# /usr/local/lib is not system LD path, the solution is below | ||
ENV LD_LIBRARY_PATH=/usr/local/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# this layer add ssh, X11 forwarding, sudo capacity | ||
# it can be based on any image, to add ssh access feature | ||
# mkdir .ssh | ||
# ssh-keygen -b 1024 -t rsa -f .ssh/ssh_host_key_rsa | ||
# build with the following command (in the folder where pubkey has been generated) | ||
# sudo docker build -f Dockerfile_ssh -t ppp_openmc_ssh . --no-cache | ||
|
||
# To test ssh X11Forwarding | ||
# 1) client must have been tested to be working with X11 forwarding with other remote ssh server | ||
# debug connection by -v option `ssh -vv -Y -p 2222 [email protected]` | ||
# 2) user root is not usually allowed to do X11 forwarding, | ||
# | ||
# if can not open DISPLAY, check if -X or -Y option has been set in ssh client command | ||
# | ||
# error "X11 forwarding request failed on channel 0" | ||
# solved by adding `X11UseLocalhost no` `X11Forwarding yes` to /etc/ssh/sshd_config | ||
############################################################################ | ||
|
||
FROM qingfengxia/ppp_openmc | ||
|
||
USER root | ||
|
||
#################### | ||
# install ssh server | ||
#################### | ||
RUN apt-get install openssh-server nano -y | ||
|
||
################# ssh user #################### | ||
|
||
|
||
# change password, add to sudo group | ||
RUN echo 'jovyan:test' | chpasswd && usermod -aG sudo $NB_USER | ||
|
||
# Allow members of group sudo to execute any command | ||
# TAB key causes some trouble, use more spaces before "ALL=" seems working | ||
RUN echo "%sudo ALL=(ALL:ALL) ALL" >> /etc/sudoers | ||
# if above still not working add this user to /etc/sudoers | ||
#RUN echo "$NB_USER ALL=(ALL:ALL) ALL" >> /etc/sudoers | ||
|
||
############### host key setup ################# | ||
# https://nickjanetakis.com/blog/docker-tip-56-volume-mounting-ssh-keys-into-a-docker-container | ||
# copy the ssh key from host, so to fix the host public key when rebuilding the image | ||
|
||
COPY .ssh /root/.ssh | ||
RUN chmod 700 /root/.ssh && \ | ||
chmod 644 /root/.ssh/ssh_host_key_rsa.pub && \ | ||
chmod 600 /root/.ssh/ssh_host_key_rsa | ||
|
||
RUN cp /root/.ssh/ssh_host_key_rsa.pub /etc/ssh/ && \ | ||
cp /root/.ssh/ssh_host_key_rsa /etc/ssh/ | ||
|
||
# sshd_config has been modified by adding those lines | ||
# to enable X11 forwarding via ssh, by default has been enabled | ||
RUN echo "X11Forwarding yes" >> /etc/ssh/sshd_config && echo "X11UseLocalhost no" >> /etc/ssh/sshd_config | ||
RUN echo "HostKey /etc/ssh/ssh_host_key_rsa" >> /etc/ssh/sshd_config | ||
|
||
# expose port, the default port | ||
EXPOSE 22 | ||
################## | ||
|
||
|
||
CMD ["/usr/sbin/sshd", "-D"] | ||
|
||
|
||
USER $NB_USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,19 +170,7 @@ yum install opencascade-draw, opencascade-foundation, opencascade-modeling, op | |
|
||
#### Option 2: Download the opencascade source code and compile from source. | ||
|
||
if not in package repository | ||
|
||
```bash | ||
###### dependencies needed to build OpenCASCADE from source ########## | ||
# for OpenCASCADE, openGL is needed | ||
yum install tbb tbb-devel freetype freetype-devel freeimage freeimage-devel -y \ | ||
&& yum install libXmu-devel libXi-devel glew-devel SDL2-devel SDL2_image-devel glm-devel -y | ||
# install those below if draw module is enabled for building OpenCASCADE | ||
yum install tk tcl tk-devel tcl-devel -y | ||
|
||
# package name distinguish capital letter, while debian name is just libxmu | ||
yum install openmpi-devel boost-devel -y | ||
``` | ||
Compile opencascade if not available in package repository, e.g. centos 7/8, see the "Dockerfile_centos" file for updated instructions. | ||
|
||
To get the latest source code from [OCCT official website](https://www.opencascade.com/), you need register (free of charge). Registered user may setup public ssh key and get readonly access to the occt repo | ||
`git clone -b V7_4_0p1 [email protected]:occt occt` | ||
|
@@ -200,7 +188,7 @@ tar -xzf occt.tar.gz | |
cd occt-* | ||
mkdir build | ||
cd build | ||
cmake .. | ||
cmake .. -DUSE_TBB=ON -DBUILD_MODULE_Draw=OFF | ||
make -j$(nproc) | ||
sudo make install | ||
# by default install to the prefix: /usr/local/ | ||
|