diff --git a/Wrapping/Python/PackageUtility/PythonWheelDocker/Dockerfile-x86_64 b/Wrapping/Python/PackageUtility/PythonWheelDocker/Dockerfile-x86_64 index e3fc29bf97..dfc52a68b8 100644 --- a/Wrapping/Python/PackageUtility/PythonWheelDocker/Dockerfile-x86_64 +++ b/Wrapping/Python/PackageUtility/PythonWheelDocker/Dockerfile-x86_64 @@ -1,61 +1,63 @@ FROM quay.io/pypa/manylinux1_x86_64 MAINTAINER Insight Software Consortium -ENV http_proxy http://www-int2.dkfz-heidelberg.de:3128/ -ENV https_proxy https://www-int2.dkfz-heidelberg.de:3128/ +#ENV http_proxy http://www-int2.dkfz-heidelberg.de:3128/ +ENV http_proxy http://www-int2.dkfz-heidelberg.de:80/ +#ENV https_proxy https://www-int2.dkfz-heidelberg.de:3128/ +ENV https_proxy https://www-int2.dkfz-heidelberg.de:80/ ENV QT_VERSION_A=5.11 ENV QT_VERSION_B=5.11.2 ENV CMAKE_VERSION_A=3.11 ENV CMAKE_VERSION_B=3.11.4 ADD https://cmake.org/files/v${CMAKE_VERSION_A}/cmake-${CMAKE_VERSION_B}-Linux-x86_64.sh \ https://www.openssl.org/source/openssl-1.0.2h.tar.gz \ /tmp/ ADD http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz \ https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2 \ http://www.mpfr.org/mpfr-3.1.3/mpfr-3.1.3.tar.bz2 \ https://ftp.gnu.org/gnu/mpc/mpc-1.0.2.tar.gz \ http://bugseng.com/products/ppl/download/ftp/releases/1.1/ppl-1.1.tar.bz2 \ http://www.bastoul.net/cloog/pages/download/cloog-0.18.1.tar.gz \ http://ftp.gnu.org/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.bz2 \ http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2 \ http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz \ /tmp/archives/ RUN yum -y install nano libXt-devel tcp_wrappers ########################################################## Install CMAKE #################################################### RUN cd /tmp \ && mkdir /opt/cmake \ && chmod +x cmake-${CMAKE_VERSION_B}-Linux-x86_64.sh \ && sh ./cmake-${CMAKE_VERSION_B}-Linux-x86_64.sh --prefix=/opt/cmake --skip-license \ && ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake \ && cmake --version WORKDIR /tmp/ ########################################################## Install GCC ###################################################### ########################################################## Install libTiff ################################################## ########################################################## Install OpenSSL ################################################## COPY ./imagefiles/install-openssl.sh ./ COPY ./imagefiles/install-gcc.sh ./ COPY ./imagefiles/install-libtiff.sh ./ RUN bash -v install-gcc.sh /usr/local && \ bash -v install-libtiff.sh && \ bash -v install.sh && \ rm -rf /tmp/* ########################################################## Install QT ####################################################### COPY imagefiles/qt-noninteractive.qs /opt/qt-noninteractive.qs RUN wget https://download.qt.io/archive/qt/${QT_VERSION_A}/${QT_VERSION_B}/qt-opensource-linux-x64-${QT_VERSION_B}.run \ && chmod +x qt-opensource-linux-x64-${QT_VERSION_B}.run \ && ./qt-opensource-linux-x64-${QT_VERSION_B}.run --script /opt/qt-noninteractive.qs -platform minimal --proxy --verbose \ && rm qt-opensource-linux-x64-${QT_VERSION_B}.run # User is expected to mount directory to "/work" ENTRYPOINT ["bash", "-c", "groupadd -o -g $_GROUPID $_USER && useradd -m -o -g $_GROUPID $_USER -u $_USERID && su $_USER /work/io/imagefiles/cmd.sh" ] diff --git a/Wrapping/Python/PackageUtility/PythonWheelDocker/run.sh b/Wrapping/Python/PackageUtility/PythonWheelDocker/run.sh index d8d98da483..abc2e5115d 100755 --- a/Wrapping/Python/PackageUtility/PythonWheelDocker/run.sh +++ b/Wrapping/Python/PackageUtility/PythonWheelDocker/run.sh @@ -1,27 +1,27 @@ #!/bin/sh if [ -n "$ExternalData_OBJECT_STORES" -a -d "$ExternalData_OBJECT_STORES" ] ; then extra_args="-v ${ExternalData_OBJECT_STORES}:/var/io/.ExternalData -e ExternalData_OBJECT_STORES=/var/io/.ExternalData" fi if [ ! -z "${MITK_GIT_TAG}" ] ; then extra_args="${extra_args} -e MITK_GIT_TAG=${MITK_GIT_TAG}" fi # example versions: "cp27-cp27m cp27-cp27mu cp36-cp36m" if [ ! -z "${PYTHON_VERSIONS}" ] ; then extra_args="${extra_args} -e PYTHON_VERSIONS=${PYTHON_VERSIONS}" fi for ARCH in x86_64; do - # Docker container is build for a specific target plattfrom. + # Docker container is build for a specific target plattfrom. # docker build --pull=true --rm=true -t mitk_manylinux_${ARCH} -f Dockerfile-${ARCH} . - docker build --pull=true -t mitk_manylinux_${ARCH} -f dockerfile-${ARCH} + docker build --pull=true -t mitk_manylinux_${ARCH} -f Dockerfile-${ARCH} . - # Docker file is ran in order to generate the python wheels in it. - docker run --storage-opt size=150G --rm -e _USER=$(id -un) -e _USERID=$(id -u) -e_GROUPID=$(id -g) $extra_args -v $(pwd):/work/io -t pymitk_manylinux_${ARCH} + # Docker file is ran in order to generate the python wheels in it. + # docker run --storage-opt size=150G --rm -e _USER=$(id -un) -e _USERID=$(id -u) -e_GROUPID=$(id -g) $extra_args -v $(pwd):/work/io -t pymitk_manylinux_${ARCH} # use this command to get an interactive prompt to debug behavior #docker run --rm -i -t --entrypoint=/bin/bash -u=root $extra_args -v $(pwd):/var/io mitk_manylinux_${ARCH} done diff --git a/Wrapping/Python/PackageUtility/UbuntuPackageDocker/Dockerfile b/Wrapping/Python/PackageUtility/UbuntuPackageDocker/Dockerfile index 8f43a85893..3123b62507 100644 --- a/Wrapping/Python/PackageUtility/UbuntuPackageDocker/Dockerfile +++ b/Wrapping/Python/PackageUtility/UbuntuPackageDocker/Dockerfile @@ -1,106 +1,177 @@ FROM ubuntu:16.04 as builder MAINTAINER Michael WORKDIR /opt # Define the target software versions ENV QT_VERSION_A=5.11 ENV QT_VERSION_B=5.11.2 ENV CMAKE_VERSION_A=3.11 ENV CMAKE_VERSION_B=3.11.4 ENV MITK_HASH T25826-RadiomicsGUIUpdate # These lines are necessary in order to be able to updates the packages from within the DKFZ Network ENV http_proxy http://www-int2.dkfz-heidelberg.de:3128/ ENV https_proxy https://www-int2.dkfz-heidelberg.de:3128/ # Basic development tools RUN apt-get -y update && apt-get -y install \ build-essential \ git \ libfontconfig1-dev \ libwrap0-dev \ libglu1-mesa-dev \ wget \ libxt-dev \ libtiff5-dev \ libdbus-1-3 \ libwrap0-dev \ patchelf # Python development tools RUN apt-get -y update && apt-get -y install \ cython \ python-pip \ unzip \ libsundials-serial-dev \ python3-pip RUN mkdir /opt/mitk-bin \ && mkdir /opt/bin #ENV QT_VERSION_SCRIPT=594 COPY files/qt-noninteractive.qs /opt/qt-noninteractive.qs RUN wget https://download.qt.io/archive/qt/${QT_VERSION_A}/${QT_VERSION_B}/qt-opensource-linux-x64-${QT_VERSION_B}.run \ && chmod +x qt-opensource-linux-x64-${QT_VERSION_B}.run \ && ./qt-opensource-linux-x64-${QT_VERSION_B}.run --script /opt/qt-noninteractive.qs -platform minimal --proxy --verbose \ && rm qt-opensource-linux-x64-${QT_VERSION_B}.run #COPY files/cmake-3.10.3-Linux-x86_64.sh /cmake-3.10.3-Linux-x86_64.sh RUN wget https://cmake.org/files/v${CMAKE_VERSION_A}/cmake-${CMAKE_VERSION_B}-Linux-x86_64.sh \ && mkdir /opt/cmake \ && chmod +x cmake-${CMAKE_VERSION_B}-Linux-x86_64.sh \ && sh ./cmake-${CMAKE_VERSION_B}-Linux-x86_64.sh --prefix=/opt/cmake --skip-license \ && ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake \ && cmake --version \ && rm cmake-${CMAKE_VERSION_B}-Linux-x86_64.sh RUN git clone -n https://phabricator.mitk.org/source/mitk.git mitk-src && cd mitk-src && git checkout $MITK_HASH \ && cd /opt/mitk-bin \ && cmake \ -DCMAKE_BUILD_TYPE:STRING=Release \ -DQt5_DIR:PATH=/qt/${QT_VERSION_B}/gcc_64/lib/cmake/Qt5/ \ -DMITK_USE_BLUEBERRY:BOOL=ON \ -DMITK_USE_CTK:BOOL=ON \ -DMITK_USE_Qt5:BOOL=ON \ -DMITK_USE_Vigra:BOOL=ON \ -DMITK_USE_HDF5:BOOL=ON \ -DMITK_USE_OpenCV:BOOL=ON \ -DBUILD_TESTING:BOOL=OFF \ -DMITK_USE_SWIG:BOOL=ON \ -DMITK_USE_MatchPoint=ON\ -DCMAKE_BUILD_TYPE:STRING=Release \ - -DCMAKE_INSTALL_PREFIX=/opt/install \ -DGIT_EXECUTABLE:PATH=/usr/bin/git \ ../mitk-src \ && make -j"$(nproc)" MITK-Configure +# Disabled Option +# -DCMAKE_INSTALL_PREFIX=/opt/install \ + + RUN cd mitk-bin/MITK-build \ && cmake \ -DBUILD_ClassificationMiniApps:Bool=ON . \ -DBUILD_BasicImageProcessingMiniApps:Bool=ON . \ -DPYTHON_EXECUTABLE:PATH=/usr/bin/python3.5m \ -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.5m \ -DPYTHON_LIBRARY:PATH=/usr/lib/x86_64-linux-gnu/libpython3.5m.so \ -DWRAP_PYTHON=ON . \ && make -j"$(nproc)" \ && make dist \ && ldd /opt/mitk-bin/MITK-build/bin/MitkFileConverter | awk 'BEGIN{ORS=" "}$1~/^\//{print $1}$3~/^\//{print $3}' | xargs -i -n 1 -d ' ' cp {} /opt/bin \ && cp /opt/mitk-bin/MITK-build/bin/MitkFileConverter /opt/bin RUN cd /opt/bin/ && patchelf --set-rpath /opt/bin/ MitkFileConverter #&& cd /opt/ \ #&& rm -rf /opt/mitk-* ENV LD_LIBRARY_PATH /opt/bin/ -ENV INPUTDIR=/input -ENV OUTPUTDIR=/output -ENV CONVERTFROM=dcm -ENV CONVERTTO=nrrd -ENV FILECONVERTER=/opt/mitk-bin/MITK-build/bin +RUN apt-get -y update && apt-get -y install \ + bison \ + docbook-xsl-ns \ + flex \ + gperf \ + gyp \ + libasound2-dev \ + libbz2-dev \ + libcap-dev \ + libcups2-dev \ + libdrm-dev \ + libegl1-mesa-dev \ + libfontconfig1-dev \ + libgcrypt11-dev \ + libglu1-mesa-dev \ + libnss3-dev \ + libpci-dev \ + libpulse-dev \ + libssl-dev \ + libtiff5-dev \ + libudev-dev \ + libwrap0-dev \ + libxcb-xinerama0-dev \ + libxcomposite-dev \ + libxcursor-dev \ + libxdamage-dev \ + libxrandr-dev \ + libxss-dev \ + libxt-dev \ + libxtst-dev \ + ninja-build \ + ruby \ + xvfb \ + xz-utils + +RUN cd mitk-bin/MITK-build \ + && make package +RUN echo $(find /opt/mitk-bin/MITK-build/ -name MITK-*.tar.gz -maxdepth 1) + +RUN mkdir /opt/mitk-inst \ + && tar -xzvf $(find /opt/mitk-bin/MITK-build/ -name MITK-*.tar.gz -maxdepth 1) -C /opt/mitk-inst \ + && mv $(find /opt/mitk-inst/ -name MITK-* -maxdepth 1) /opt/mitk-inst/mitk + +################################################################################################################################ +################################## Final Container ############################################################################# +################################################################################################################################ +FROM ubuntu:16.04 as final +MAINTAINER Michael +WORKDIR /opt + +# These lines are necessary in order to be able to updates the packages from within the DKFZ Network +ENV http_proxy http://www-int2.dkfz-heidelberg.de:3128/ +ENV https_proxy https://www-int2.dkfz-heidelberg.de:3128/ + +# Basic development tools +RUN apt-get -y update && apt-get -y install \ + libglib2.0-0 \ + libjpeg-turbo8 \ + libfontconfig1 \ + libtiff5 \ + nano \ + python3-pip + +COPY --from=builder /opt/mitk-inst/mitk /opt/mitk +RUN printf '%s\n' '/opt/mitk/bin' '/opt/mitk/bin/plugins' > /etc/ld.so.conf.d/mitklibs.conf \ + && ldconfig + +COPY --from=builder /opt/mitk-bin/MITK-build/Wrapping/Python/dist/pyMITK-2016.11.99-cp35-cp35m-linux_x86_64.whl /opt/pyMITK-2016.11.99-cp35-cp35m-linux_x86_64.whl +RUN pip3 install pyMITK-2016.11.99-cp35-cp35m-linux_x86_64.whl \ + && python3 -c 'import pyMITK' + +############## For testing purpose only ################# +#COPY flair.nii.gz flair.nii.gz +#COPY image.dcm image.dcm +#RUN (echo "import pyMITK as mitk\nimage=mitk.IOUtil.Load('/opt/image.dcm')") | python3 -COPY mitk_fileconverter.sh /mitk_fileconverter.sh -ENTRYPOINT ["/bin/bash", "/mitk_fileconverter.sh"]