initial implementation of docker scripts

LT1AB
Gerald Manipon 2019-03-22 03:42:18 +00:00
parent 4ee7fa18d7
commit 4ae735060c
5 changed files with 169 additions and 0 deletions

99
docker/Dockerfile Normal file
View File

@ -0,0 +1,99 @@
FROM hysds/pge-base:latest
# Set an encoding to make things work smoothly.
ENV LANG en_US.UTF-8
# Set ISCE repo
#ENV ISCE_ORG isce-framework
ENV ISCE_ORG pymonger
ENV ISCE_REPO github.com/${ISCE_ORG}/isce2.git
# set to root user
USER root
# install tools for RPM generation
RUN set -ex \
&& yum update -y \
&& yum groupinstall -y "development tools" \
&& yum install -y \
make ruby-devel rpm-build rubygems \
&& gem install --no-ri --no-rdoc fpm
# install isce requirements
RUN set -ex \
&& . /opt/conda/bin/activate root \
&& conda install --yes \
cython \
gdal \
git \
h5py \
libgdal \
pytest \
numpy \
fftw \
scipy \
basemap \
scons \
opencv \
hdf4 \
hdf5 \
netcdf4 \
libgcc \
libstdcxx-ng \
cmake \
&& yum install -y uuid-devel x11-devel motif-devel jq \
&& ln -sf /opt/conda/bin/cython /opt/conda/bin/cython3
# copy repo
COPY . /root/isce2
# build ISCE
RUN set -ex \
&& . /opt/conda/bin/activate root \
&& cd /root \
&& source isce2/docker/build_env.sh \
&& mkdir -p $BUILD_DIR \
&& cp isce2/docker/SConfigISCE isce2/configuration/ \
&& cd isce2 \
&& scons install \
&& cp docker/isce_env.sh $ISCE_INSTALL_ROOT \
&& mkdir -p rpm-build/opt \
&& mv $ISCE_INSTALL_ROOT rpm-build/opt \
&& curl -s https://api.github.com/repos/pymonger/isce2/git/refs/heads/master \
> rpm-build/opt/isce2/version.json \
&& hash=$(cat rpm-build/opt/isce2/version.json | jq -r .object.sha) \
&& short_hash=$(echo $hash | cut -c1-5) \
&& fpm -s dir -t rpm -C rpm-build --name isce \
--prefix=/ --version=2.0 --provides=isce \
--maintainer=piyush.agram@jpl.nasa.gov \
--description="InSAR Scientific Computing Environment v2 (${hash})"
FROM hysds/pge-base:latest
# Set an encoding to make things work smoothly.
ENV LANG en_US.UTF-8
# install ISCE from RPM
COPY --from=0 /root/isce2/isce-2.0-1.x86_64.rpm /tmp/isce-2.0-1.x86_64.rpm
# install isce and its minimal requirements
RUN set -ex \
&& sudo /opt/conda/bin/conda install --yes \
gdal \
h5py \
libgdal \
pytest \
numpy \
fftw \
scipy \
basemap \
opencv \
hdf4 \
hdf5 \
netcdf4 \
&& sudo yum update -y \
&& sudo yum install -y uuid-devel x11-devel motif-devel \
&& sudo yum install -y /tmp/isce-2.0-1.x86_64.rpm \
&& sudo yum clean all \
&& sudo rm -rf /var/cache/yum \
&& sudo rm /tmp/isce-2.0-1.x86_64.rpm

16
docker/README.md Normal file
View File

@ -0,0 +1,16 @@
# ISCE in docker
## Build
1. Clone repo:
```
git clone https://github.com/isce-framework/isce2.git
```
1. Change directory:
```
cd isce2
```
1. Build image:
```
docker build --rm --force-rm -t hysds/isce_giant -f docker/Dockerfile .
```

44
docker/SConfigISCE Normal file
View File

@ -0,0 +1,44 @@
# The directory in which ISCE will be built
PRJ_SCONS_BUILD = $ISCE_BUILD_ROOT/isce2
# The directory into which ISCE will be installed
PRJ_SCONS_INSTALL = $ISCE_INSTALL_ROOT/isce
# The location of libraries, such as libstdc++, libfftw3 (for most system
# it's /usr/lib and/or /usr/local/lib/ and/or /opt/local/lib)
LIBPATH = /usr/lib64 /usr/lib /opt/conda/lib
# The location of Python.h. If you have multiple installations of python
# make sure that it points to the right one
CPPPATH = /opt/conda/include/python3.7m /opt/conda/lib/python3.7/site-packages/numpy/core/include /opt/conda/include /usr/include
# The location of the fftw3.h (most likely something like /usr/include or
# /usr/local/include /opt/local/include
FORTRANPATH = /usr/include /opt/conda/include
# The location of your Fortran compiler. If not specified it will use the system one
FORTRAN = /bin/gfortran
# The location of your C compiler. If not specified it will use the system one
CC = /bin/gcc
# The location of your C++ compiler. If not specified it will use the system one
CXX = /bin/g++
#libraries needed for mdx display utility
MOTIFLIBPATH = /usr/lib64 # path to libXm.dylib
X11LIBPATH = /usr/lib64 # path to libXt.dylib
MOTIFINCPATH = /usr/include # path to location of the Xm
# directory with various include files (.h)
X11INCPATH = /usr/include # path to location of the X11 directory
# with various include files
# list of paths to search for shared libraries when running programs
RPATH = /opt/conda/lib /usr/lib64 /usr/lib
# additional linker flags
LINKFLAGS = -luuid
#Explicitly enable cuda if needed
ENABLE_CUDA = True
#CUDA_TOOLKIT_PATH = $YOUR_CUDA_INSTALLATION #/usr/local/cuda

5
docker/build_env.sh Executable file
View File

@ -0,0 +1,5 @@
export BUILD_DIR=/root/build-isce
export ISCE_SRC=$HOME/isce2
export SCONS_CONFIG_DIR=$ISCE_SRC/configuration
export ISCE_BUILD_ROOT=$BUILD_DIR/build
export ISCE_INSTALL_ROOT=/opt/isce2

5
docker/isce_env.sh Executable file
View File

@ -0,0 +1,5 @@
export PYTHONPATH=/opt/isce2:$PYTHONPATH
export ISCE_HOME=/opt/isce2/isce
export PATH=$ISCE_HOME/applications:$ISCE_HOME/bin:/opt/conda/bin:$PATH
export LD_LIBRARY_PATH=/opt/conda/lib:$LD_LIBRARY_PATH
export GDAL_DATA=/opt/conda/share/gdal