diff --git a/opensim-core/opensim-cpp/dockerfile-ubuntu b/opensim-core/opensim-cpp/dockerfile-ubuntu index 0147509..03a969a 100644 --- a/opensim-core/opensim-cpp/dockerfile-ubuntu +++ b/opensim-core/opensim-cpp/dockerfile-ubuntu @@ -1,15 +1,19 @@ -FROM stanfordnmbl/opensim-deps +FROM stanfordnmbl/opensim-deps:latest LABEL maintainer="Ayman Habib" # Build cpp only libraries and cli for opensim-core no bindings RUN mkdir opensim_build \ && cd opensim_build \ - && cmake ../opensim-core \ + && cmake ../opensim-core -LAH \ -DCMAKE_INSTALL_PREFIX=$OPENSIM_INSTALL -DOPENSIM_DEPENDENCIES_DIR=$OPENSIM_DEPENDENCIES_HOME \ - -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=OFF \ + -DOPENSIM_C3D_PARSER=ezc3d -DOPENSIM_WITH_TROPTER=OFF -DOPENSIM_WITH_CASADI=OFF -DBUILD_TESTING=OFF \ && make -j8 \ && make install \ && rm -rf ../opensim_build +# Set LD_LIBRARY_PATH so pyhton can load the shard libraries +ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSIM_DEPENDENCIES_HOME/simbody/lib:$OPENSIM_INSTALL/lib" +ENV PATH=$PATH:"$OPENSIM_INSTALL/bin" + # image stored at stanfordnmbl/opensim-cpp diff --git a/opensim-core/opensim-cpp/moco-dockerfile-ubuntu b/opensim-core/opensim-cpp/moco-dockerfile-ubuntu new file mode 100644 index 0000000..ae15fd0 --- /dev/null +++ b/opensim-core/opensim-cpp/moco-dockerfile-ubuntu @@ -0,0 +1,19 @@ +FROM stanfordnmbl/opensim-deps:latest-with-moco + +LABEL maintainer="Ayman Habib" + +# Build cpp only libraries and cli for opensim-core no bindings +RUN mkdir opensim_build \ + && cd opensim_build \ + && cmake ../opensim-core -LAH \ + -DCMAKE_INSTALL_PREFIX=$OPENSIM_INSTALL -DOPENSIM_DEPENDENCIES_DIR=$OPENSIM_DEPENDENCIES_HOME \ + -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=OFF \ + && make -j8 \ + && make install \ + && rm -rf ../opensim_build + +# Set LD_LIBRARY_PATH so pyhton can load the shard libraries +ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSIM_DEPENDENCIES_HOME/simbody/lib:$OPENSIM_INSTALL/lib" +ENV PATH=$PATH:"$OPENSIM_INSTALL/bin" + +# image stored at stanfordnmbl/opensim-cpp diff --git a/opensim-core/opensim-java/dockerfile-ubuntu b/opensim-core/opensim-java/dockerfile-ubuntu index 5f57c60..1617d82 100644 --- a/opensim-core/opensim-java/dockerfile-ubuntu +++ b/opensim-core/opensim-java/dockerfile-ubuntu @@ -1,11 +1,12 @@ -FROM stanfordnmbl/opensim-deps +FROM stanfordnmbl/opensim-deps:latest LABEL maintainer="Ayman Habib" # The following sets timezone to avoid prompt for timezone when installing packages ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -RUN apt-get update && DEBIAN_FRONTEND=noninteractive && apt-get --yes install \ +RUN apt-get update && DEBIAN_FRONTEND=noninteractive \ + && apt-get --yes install \ libpcre3 libpcre3-dev flex bison # install openjdk8 @@ -42,12 +43,15 @@ RUN mkdir opensim_build \ && cd opensim_build \ && cmake ../opensim-core \ -DSWIG_DIR=~/swig/share/swig -DSWIG_EXECUTABLE=~/swig/bin/swig -DBUILD_JAVA_WRAPPING=ON -DBUILD_TESTING=OFF \ - -DCMAKE_INSTALL_PREFIX=$OPENSIM_INSTALL -DOPENSIM_DEPENDENCIES_DIR=$OPENSIM_DEPENDENCIES_HOME \ + -DOPENSIM_WITH_TROPTER=OFF -DOPENSIM_WITH_CASADI=OFF -DCMAKE_INSTALL_PREFIX=$OPENSIM_INSTALL -DOPENSIM_DEPENDENCIES_DIR=$OPENSIM_DEPENDENCIES_HOME \ -DOPENSIM_C3D_PARSER=ezc3d -DSWIG_DOXYGEN=OFF \ && make -j8 \ && make install \ && rm -rf ../opensim_build \ - && rm -rf ~/opensim_dependencies_install \ - && rm -rf $HOME/swig + && rm -rf $HOME/swig + +# Set LD_LIBRARY_PATH so pyhton can load the shard libraries +ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSIM_DEPENDENCIES_HOME/simbody/lib:$OPENSIM_INSTALL/lib" +ENV PATH=$PATH:"$OPENSIM_INSTALL/bin" # image stored at stanfordnmbl/opensim-java diff --git a/opensim-core/opensim-python/dockerfile-ubuntu b/opensim-core/opensim-python/dockerfile-ubuntu index 3557bd8..2ebec5f 100644 --- a/opensim-core/opensim-python/dockerfile-ubuntu +++ b/opensim-core/opensim-python/dockerfile-ubuntu @@ -1,4 +1,4 @@ -FROM stanfordnmbl/opensim-deps +FROM stanfordnmbl/opensim-deps:latest LABEL maintainer="Ayman Habib" @@ -34,6 +34,7 @@ RUN mkdir opensim_build \ -DSWIG_DIR=~/swig/share/swig -DSWIG_EXECUTABLE=~/swig/bin/swig -DBUILD_PYTHON_WRAPPING=ON \ -DCMAKE_INSTALL_PREFIX=$OPENSIM_INSTALL -DOPENSIM_DEPENDENCIES_DIR=$OPENSIM_DEPENDENCIES_HOME \ -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=OFF -DSWIG_DOXYGEN=OFF \ + -DOPENSIM_WITH_TROPTER=OFF -DOPENSIM_WITH_CASADI=OFF \ -DPYTHON_EXECUTABLE=/usr/bin/python3.8 \ -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 \ -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so \ @@ -41,8 +42,7 @@ RUN mkdir opensim_build \ && make -j8 \ && make install \ && rm -rf ../opensim_build \ - && rm -rf $HOME/swig \ - && cp "$OPENSIM_DEPENDENCIES_HOME/adol-c/lib64/*.so*" "$OPENSIM_DEPENDENCIES_HOME/lib" + && rm -rf $HOME/swig # Set LD_LIBRARY_PATH so pyhton can load the shard libraries ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSIM_DEPENDENCIES_HOME/simbody/lib:$OPENSIM_INSTALL/lib" diff --git a/opensim-core/opensim-python/moco-dockerfile-ubuntu b/opensim-core/opensim-python/moco-dockerfile-ubuntu new file mode 100644 index 0000000..0829cd0 --- /dev/null +++ b/opensim-core/opensim-python/moco-dockerfile-ubuntu @@ -0,0 +1,55 @@ +FROM stanfordnmbl/opensim-deps:latest-with-moco + +LABEL maintainer="Ayman Habib" + +# The following sets timezone to avoid prompt for timezone when installing packages later +ENV TZ=America/Los_Angeles +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive \ + && apt-get --yes install \ + software-properties-common \ + python3.8 python3.8-dev python3.8-distutils python3.8-venv \ + libpcre3 libpcre3-dev flex bison +RUN wget https://bootstrap.pypa.io/get-pip.py \ + && python3.8 get-pip.py \ + && pip3.8 install numpy + +# install Swig from source then install +RUN mkdir ~/swig-source && cd ~/swig-source \ + && wget https://github.com/swig/swig/archive/refs/tags/rel-4.0.2.tar.gz \ + && tar xzf rel-4.0.2.tar.gz \ + && cd swig-rel-4.0.2 \ + && sh autogen.sh \ + && ./configure --prefix=$HOME/swig --disable-ccache \ + && make \ + && make -j4 install \ + && rm -rf ~/swig-source + +# Build and install opensim-core with python bindings +RUN mkdir opensim_build \ + && cd opensim_build \ + && cmake ../opensim-core \ + -DSWIG_DIR=~/swig/share/swig -DSWIG_EXECUTABLE=~/swig/bin/swig -DBUILD_PYTHON_WRAPPING=ON \ + -DCMAKE_INSTALL_PREFIX=$OPENSIM_INSTALL -DOPENSIM_DEPENDENCIES_DIR=$OPENSIM_DEPENDENCIES_HOME \ + -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=OFF -DSWIG_DOXYGEN=OFF \ + -DPYTHON_EXECUTABLE=/usr/bin/python3.8 \ + -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 \ + -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so \ + -DPYTHON_NUMPY_INCLUDE_DIR=/usr/local/lib/python3.8/dist-packages/numpy/core/include \ + && make -j8 \ + && make install \ + && rm -rf ../opensim_build \ + && rm -rf $HOME/swig + +# Set LD_LIBRARY_PATH so pyhton can load the shard libraries +ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPENSIM_DEPENDENCIES_HOME/simbody/lib:$OPENSIM_INSTALL/lib" +ENV PATH=$PATH:"$OPENSIM_INSTALL/bin" + +# Ideally we install the module but that doesn't work now, so we set PYTHONPATH instead +ENV PYTHONPATH="$OPENSIM_INSTALL/lib/python3.8/site-packages" +# RUN cd "$OPENSIM_INSTALL/lib/python3.8/site-packages" \ +# && python3.8 setup.py install + +# image stored at stanfordnmbl/opensim-python diff --git a/opensim-deps/dockerfile-ubuntu b/opensim-deps/dockerfile-ubuntu index f199fdf..acdfbbd 100644 --- a/opensim-deps/dockerfile-ubuntu +++ b/opensim-deps/dockerfile-ubuntu @@ -15,14 +15,17 @@ ENV OPENSIM_INSTALL="/opensim_install" RUN apt-get update && DEBIAN_FRONTEND=noninteractive && apt-get --yes --fix-missing install \ git \ build-essential libtool autoconf \ - cmake cmake-curses-gui \ wget \ pkg-config \ gfortran \ freeglut3-dev \ libxi-dev libxmu-dev liblapack-dev libopenblas-dev \ - cmake cmake-curses-gui \ - coinor-libipopt-dev libcolpack-dev + software-properties-common + +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - \ + && apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \ + && apt-get update \ + && apt install --yes cmake cmake-curses-gui # This clones latest master, we should use tags for public releases RUN git clone https://github.com/opensim-org/opensim-core.git \ @@ -34,8 +37,8 @@ RUN mkdir opensim_dependencies_build \ && cd opensim_dependencies_build \ && cmake ../opensim-core/dependencies/ \ -LAH -DCMAKE_INSTALL_PREFIX=$OPENSIM_DEPENDENCIES_HOME -DCMAKE_BUILD_TYPE=Release \ - -DSUPERBUILD_ezc3d=ON -DSUPERBUILD_casadi=ON -DSUPERBUILD_adolc=ON -DSUPERBUILD_ipopt=ON \ - -DSUPERBUILD_colpack=ON \ + -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_TROPTER=OFF \ + -DOPENSIM_WITH_CASADAI=OFF \ && make -j8 \ && rm -rf ../opensim_dependencies_build diff --git a/opensim-deps/moco-dockerfile-ubuntu b/opensim-deps/moco-dockerfile-ubuntu new file mode 100644 index 0000000..6d9a152 --- /dev/null +++ b/opensim-deps/moco-dockerfile-ubuntu @@ -0,0 +1,43 @@ +FROM ubuntu:18.04 + +LABEL maintainer="Ayman Habib" + +# Prepare environment variables with paths used now and later (using absolute paths ) + +# Set environment variable with the dependencies install directory +ENV OPENSIM_DEPENDENCIES_HOME="/opensim_dependencies_install" + +# Set environment variable with the OpenSim install directory (will be used by child images) +ENV OPENSIM_INSTALL="/opensim_install" + +# Set DEBIAN_FRONTEND to avoid interactive timezone prompt when installing +# packages. +RUN apt-get update && DEBIAN_FRONTEND=noninteractive && apt-get --yes --fix-missing install \ + git \ + build-essential libtool autoconf \ + wget \ + pkg-config \ + gfortran \ + freeglut3-dev \ + libxi-dev libxmu-dev liblapack-dev libopenblas-dev \ + software-properties-common + +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - \ + && apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \ + && apt-get update \ + && apt install --yes cmake cmake-curses-gui + +# This clones latest master, we should use tags for public releases +RUN git clone https://github.com/opensim-org/opensim-core.git \ + && cd /opensim-core \ + && git checkout master \ + && rm -rf .git + +RUN mkdir opensim_dependencies_build \ + && cd opensim_dependencies_build \ + && cmake ../opensim-core/dependencies/ \ + -LAH -DCMAKE_INSTALL_PREFIX=$OPENSIM_DEPENDENCIES_HOME -DCMAKE_BUILD_TYPE=Release \ + -DOPENSIM_WITH_TROPTER=ON -DOPENSIM_WITH_CASADI=ON -DSUPERBUILD_ezc3d=ON \ + && make -j8 + +# images are stored in stanfordnmbl/opensim-deps