Skip to content

Commit

Permalink
add docker development kit
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarriba committed Sep 1, 2018
1 parent f9803c7 commit ae8d9e1
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
41 changes: 41 additions & 0 deletions dev_env.sh
Original file line number Diff line number Diff line change
@@ -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"

18 changes: 18 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ae8d9e1

Please sign in to comment.