Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

add docker development kit

edgarriba29bebdf26380
diff --git a/dev_env.sh b/dev_env.sh
new file mode 100755
index 000000000..57ff35bd8
--- /dev/null
+++ b/dev_env.sh
@@ -0,0 +1,41 @@
+#!/bin/bash -ex
+# The purpose of this script is simplify running scripts inside of our
+# dev_env docker container. It mounts the workspace and the
+# workspace/../build directory inside of the container, and executes
+# any arguments passed to the dev_env.sh
+script_link="$( readlink "$BASH_SOURCE" )" || script_link="$BASH_SOURCE"
+apparent_sdk_dir="${script_link%/*}"
+if [ "$apparent_sdk_dir" == "$script_link" ]; then
+ apparent_sdk_dir=.
+fi
+sdk_dir="$( command cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"
+
+bash_args=$@
+if [[ -z "$bash_args" ]] ; then
+ bash_args=bash
+fi
+
+docker_data_volume="-v ${DATA_DIR}:${DATA_DIR}"
+if [[ -z "$DATA_DIR" ]] ; then
+ docker_data_volume="-v $(pwd):$(pwd)"
+fi
+
+docker_command=nvidia-docker
+
+repo=${ARRAIY_REPO:=arraiy/torchgeometry}
+
+$docker_command \
+ run \
+ -it \
+ $docker_data_volume \
+ -v $sdk_dir:/code/torchgeometry \
+ -v $HOME/.Xauthority:/root/.Xauthority \
+ --net=host \
+ --env="DISPLAY" \
+ --env="QT_X11_NO_MITSHM=1" \
+ --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
+ --privileged \
+ --device /dev/dri \
+ $repo \
+ bash -c "cd /code/torchgeometry && $bash_args"
+
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 000000000..1622a9ef4
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,18 @@
+FROM nvidia/cuda:9.1-cudnn7-devel-ubuntu16.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ curl \
+ vim \
+ ca-certificates &&\
+rm -rf /var/lib/apt/lists/*
+
+RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
+ chmod +x ~/miniconda.sh && \
+ ~/miniconda.sh -b -p /opt/conda && \
+ rm ~/miniconda.sh && \
+ /opt/conda/bin/conda install -y python=$PYTHON_VERSION numpy pyyaml scipy ipython mkl mkl-include cython typing && \
+ /opt/conda/bin/conda install -y -c pytorch magma-cuda90 && \
+ /opt/conda/bin/conda clean -ya
+ENV PATH /opt/conda/bin:$PATH
+
+RUN conda install pytorch torchvision cuda91 -c pytorch
diff --git a/docker/build.sh b/docker/build.sh
new file mode 100755
index 000000000..a98e91e4a
--- /dev/null
+++ b/docker/build.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -ex
+# This script is useful to build the dev_env container.
+script_link="$( readlink "$BASH_SOURCE" )" || script_link="$BASH_SOURCE"
+apparent_sdk_dir="${script_link%/*}"
+if [ "$apparent_sdk_dir" == "$script_link" ]; then
+ apparent_sdk_dir=.
+fi
+
+sdk_dir="$( command cd -P "$apparent_sdk_dir/../" > /dev/null && pwd -P )"
+
+# This builds the docker file, from the root of the workspace
+docker build -t arraiy/torchgeometry -f Dockerfile $sdk_dir