Add Dockerfiles for building and running OmniGibson images (#72)
* Prepare for Docker release * Lowercase needed * Executable perms * Try another installation order * Add Omniverse EULA stuff * Yes or no * Spacing * Update Dockerfile * Remove mamba * Another attempt * Reditch Mamba * Fix accidental paste * Remove sudo * Apt call -y * Get pip * Better pip install * Revert "Better pip install" This reverts commitf5d4479b84
. * Revert "Get pip" This reverts commit61f872dd50
. * Revert "Apt call -y" This reverts commit5823393b37
. * Revert "Remove sudo" This reverts commit7e22f8007a
. * Revert "Fix accidental paste" This reverts commitd5be8d9e8e
. * Revert "Reditch Mamba" This reverts commit67cd60a9b0
. * Another attempt * Activate before pip * Init shell for mamba * Do stuff in a shell * Fix typo * Ignore docker in docker * Dont install for now * Fix install * Better micromamba * Change shell * Launch in login shell * Upgrade numpy * Remove prebundled numpy * Better job removing prebuilt * Run from web * Be nice towards xhost. * Fix script paths
This commit is contained in:
parent
79522aabbe
commit
74b3550f38
|
@ -1 +1,2 @@
|
|||
gibson/assets/dataset
|
||||
omnigibson/data
|
||||
docker
|
|
@ -2,6 +2,5 @@ include LICENSE
|
|||
|
||||
graft omnigibson
|
||||
prune omnigibson/data
|
||||
prune omnigibson/render/openvr/samples
|
||||
|
||||
global-exclude *.py[co]
|
|
@ -1,3 +0,0 @@
|
|||
REGISTRY=docker.io
|
||||
REPO=omnigibson
|
||||
VERSION=v2.0.4
|
|
@ -0,0 +1,41 @@
|
|||
FROM nvcr.io/nvidia/isaac-sim:2022.1.1
|
||||
|
||||
# Set up all the prerequisites.
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN echo "bash /isaac-sim/vulkan_check.sh" >> /root/.bashrc
|
||||
RUN rm -rf /isaac-sim/exts/omni.isaac.ml_archive/pip_prebundle/gym
|
||||
RUN rm -rf /isaac-sim/kit/extscore/omni.kit.pip_archive/pip_prebundle/numpy
|
||||
|
||||
# Add OmniGibson
|
||||
ADD . /omnigibson
|
||||
WORKDIR /omnigibson
|
||||
|
||||
# Mount the data directory
|
||||
VOLUME ["/data"]
|
||||
ENV OMNIGIBSON_DATASET_PATH /data/og_dataset
|
||||
ENV OMNIGIBSON_ASSETS_PATH /data/assets
|
||||
ENV GIBSON_DATASET_PATH /data/g_dataset
|
||||
ENV OMNIGIBSON_KEY_PATH /data/omnigibson.key
|
||||
|
||||
# Install Mamba (light conda alternative)
|
||||
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj -C / bin/micromamba
|
||||
ENV MAMBA_ROOT_PREFIX /micromamba
|
||||
RUN micromamba create -n omnigibson -c conda-forge python=3.7
|
||||
RUN micromamba shell init --shell=bash --prefix=/micromamba
|
||||
RUN echo "micromamba activate omnigibson" >> /root/.bashrc
|
||||
RUN echo "source /isaac-sim/setup_conda_env.sh" >> /root/.bashrc
|
||||
|
||||
# Install some additional niceties for working with notebooks
|
||||
SHELL ["micromamba", "run", "-n", "omnigibson", "/bin/bash", "--login", "-c"]
|
||||
RUN micromamba install -c conda-forge opencv
|
||||
|
||||
# Install OmniGibson
|
||||
RUN pip install -e .
|
||||
|
||||
ENTRYPOINT []
|
||||
|
||||
CMD ["/bin/bash"]
|
|
@ -0,0 +1,22 @@
|
|||
# Requirements
|
||||
|
||||
- Modern Linux distribution (Ubuntu 20.04, Fedora 36, etc.)
|
||||
- RTX capable Nvidia graphics card (20 series or newer,)
|
||||
- Up-to-date NVIDIA drivers
|
||||
|
||||
# Usage
|
||||
|
||||
**The below instructions concern the usage of OmniGibson containers with self-built images. Please see the BEHAVIOR-1K docs for instructions on how to pull and run a cloud image.**
|
||||
|
||||
1. Set up the NVIDIA Docker Runtime and login to the NVIDIA Container Registry
|
||||
See [here](https://www.pugetsystems.com/labs/hpc/how-to-setup-nvidia-docker-and-ngc-registry-on-your-workstation-part-4-accessing-the-ngc-registry-1115/) for details.
|
||||
|
||||
2. Build the container. **From the OmniGibson root**, run: `./docker/build_docker.sh`
|
||||
|
||||
3. Run the container
|
||||
* To get a shell inside a container with GUI: `./docker/run_docker_gui.sh`
|
||||
* To get a jupyter notebook: `./docker/run_docker_notebook.sh`
|
||||
* To get access to a shell inside a headless container `./docker/run_docker.sh`
|
||||
|
||||
# Development
|
||||
To push a Docker container, run: `./docker/push_docker.sh`
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
docker build \
|
||||
-t stanfordvl/omnigibson:latest \
|
||||
-t stanfordvl/omnigibson:$(sed -ne "s/.*version= *['\"]\([^'\"]*\)['\"] *.*/\1/p" setup.py) \
|
||||
-f docker/Dockerfile \
|
||||
.
|
|
@ -1,41 +0,0 @@
|
|||
FROM nvcr.io/nvidia/isaac-sim:2022.1.1
|
||||
|
||||
RUN echo "bash /isaac-sim/vulkan_check.sh" >> /root/.bashrc
|
||||
RUN rm -rf /isaac-sim/exts/omni.isaac.ml_archive/pip_prebundle/gym
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj -C / bin/micromamba
|
||||
|
||||
ENV MAMBA_ROOT_PREFIX /micromamba
|
||||
RUN micromamba create -n omnigibson -c conda-forge python=3.7
|
||||
RUN micromamba shell init --shell=bash --prefix=/micromamba
|
||||
ENV PATH /micromamba/envs/omnigibson/bin:$PATH
|
||||
RUN echo "source /isaac-sim/setup_conda_env.sh" >> /root/.bashrc
|
||||
|
||||
WORKDIR /
|
||||
ENV GITHUB_USER mjlbach
|
||||
ENV GITHUB_TOKEN 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
|
||||
ENV GITHUB_REPOSITORY stanfordvl/OmniGibson3.git
|
||||
RUN git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
|
||||
|
||||
ENV GITHUB_REPOSITORY stanfordvl/bddl-dev.git
|
||||
ENV GITHUB_TOKEN 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
|
||||
RUN git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
|
||||
|
||||
WORKDIR /OmniGibson3
|
||||
|
||||
RUN pip install -e .
|
||||
RUN micromamba install -n omnigibson -c conda-forge opencv
|
||||
|
||||
WORKDIR /bddl-dev
|
||||
RUN pip install -e .
|
||||
|
||||
WORKDIR /OmniGibson3/omnigibson/examples/
|
||||
|
||||
RUN sed -i "s/gm.HEADLESS = False/gm.HEADLESS = True/" /OmniGibson3/omnigibson/macros.py
|
||||
|
||||
ENTRYPOINT bash --login
|
|
@ -1 +0,0 @@
|
|||
docker build -t omnomnigibson:latest .
|
|
@ -1,3 +0,0 @@
|
|||
export OMNIGIBSON_DATA_PATH=/path/to/omnomnigibson_data
|
||||
# To run with GUI: edit macros.py and add -v /tmp/.X11-unix:/tmp/.X11-unix to container launch command
|
||||
docker run -e DISPLAY -v $OMNIGIBSON_DATA_PATH:/OmniGibson3/omnigibson/data --rm -it omnomnigibson
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
docker push stanfordvl/omnigibson:latest
|
||||
docker push stanfordvl/omnigibson:$(sed -ne "s/.*version= *['\"]\([^'\"]*\)['\"] *.*/\1/p" setup.py)
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
DATA_PATH=${1:-'~/omnigibson-data'}
|
||||
|
||||
echo "The NVIDIA Omniverse License Agreement (EULA) must be accepted before"
|
||||
echo "Omniverse Kit can start. The license terms for this product can be viewed at"
|
||||
echo "https://docs.omniverse.nvidia.com/app_isaacsim/common/NVIDIA_Omniverse_License_Agreement.html"
|
||||
|
||||
while true; do
|
||||
read -p "Do you accept the Omniverse EULA? [yn] " yn
|
||||
case $yn in
|
||||
[Yy]* ) break;;
|
||||
[Nn]* ) exit;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
|
||||
docker run \
|
||||
--gpus all \
|
||||
--privileged \
|
||||
-e DISPLAY \
|
||||
-e OMNIGIBSON_HEADLESS=1 \
|
||||
-v DATA_PATH:/data \
|
||||
--network=host --rm -it stanfordvl/omnigibson:latest
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
DATA_PATH=${1:-'~/omnigibson-data'}
|
||||
|
||||
echo "The NVIDIA Omniverse License Agreement (EULA) must be accepted before"
|
||||
echo "Omniverse Kit can start. The license terms for this product can be viewed at"
|
||||
echo "https://docs.omniverse.nvidia.com/app_isaacsim/common/NVIDIA_Omniverse_License_Agreement.html"
|
||||
|
||||
while true; do
|
||||
read -p "Do you accept the Omniverse EULA? [yn] " yn
|
||||
case $yn in
|
||||
[Yy]* ) break;;
|
||||
[Nn]* ) exit;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
|
||||
xhost +local:root
|
||||
docker run \
|
||||
--gpus all \
|
||||
--privileged \
|
||||
-e DISPLAY=${DISPLAY} \
|
||||
-v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||
-v DATA_PATH:/data \
|
||||
--network=host --rm -it stanfordvl/omnigibson:latest
|
||||
xhost -local:root
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
DATA_PATH=${1:-'~/omnigibson-data'}
|
||||
|
||||
echo "The NVIDIA Omniverse License Agreement (EULA) must be accepted before"
|
||||
echo "Omniverse Kit can start. The license terms for this product can be viewed at"
|
||||
echo "https://docs.omniverse.nvidia.com/app_isaacsim/common/NVIDIA_Omniverse_License_Agreement.html"
|
||||
|
||||
while true; do
|
||||
read -p "Do you accept the Omniverse EULA? [yn] " yn
|
||||
case $yn in
|
||||
[Yy]* ) break;;
|
||||
[Nn]* ) exit;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
|
||||
docker run \
|
||||
--gpus all \
|
||||
--privileged \
|
||||
-e DISPLAY \
|
||||
-e OMNIGIBSON_HEADLESS=1 \
|
||||
-v DATA_PATH:/data \
|
||||
--network=host --rm -it stanfordvl/omnigibson bash -c "source ~/.bashrc && jupyter lab --allow-root"
|
|
@ -23,8 +23,8 @@ with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "global_conf
|
|||
global_config = yaml.load(f, Loader=yaml.FullLoader)
|
||||
|
||||
# can override assets_path and dataset_path from environment variable
|
||||
if "GIBSON_ASSETS_PATH" in os.environ:
|
||||
assets_path = os.environ["GIBSON_ASSETS_PATH"]
|
||||
if "OMNIGIBSON_KEY_PATH" in os.environ:
|
||||
assets_path = os.environ["OMNIGIBSON_KEY_PATH"]
|
||||
else:
|
||||
assets_path = global_config["assets_path"]
|
||||
assets_path = os.path.expanduser(assets_path)
|
||||
|
@ -41,8 +41,8 @@ else:
|
|||
og_dataset_path = global_config["og_dataset_path"]
|
||||
og_dataset_path = os.path.expanduser(og_dataset_path)
|
||||
|
||||
if "KEY_PATH" in os.environ:
|
||||
key_path = os.environ["KEY_PATH"]
|
||||
if "OMNIGIBSON_KEY_PATH" in os.environ:
|
||||
key_path = os.environ["OMNIGIBSON_KEY_PATH"]
|
||||
else:
|
||||
key_path = global_config["key_path"]
|
||||
key_path = os.path.expanduser(key_path)
|
||||
|
|
|
@ -4,6 +4,8 @@ Set of macros to use globally for OmniGibson. These are generally magic numbers
|
|||
NOTE: This is generally decentralized -- the monolithic @settings variable is created here with some global values,
|
||||
but submodules within OmniGibson may import this dictionary and add to it dynamically
|
||||
"""
|
||||
import os
|
||||
|
||||
from addict import Dict
|
||||
|
||||
|
||||
|
@ -12,7 +14,7 @@ macros = Dict()
|
|||
gm = macros.globals
|
||||
|
||||
# Whether to generate a headless or non-headless application upon OmniGibson startup
|
||||
gm.HEADLESS = False
|
||||
gm.HEADLESS = (os.getenv("OMNIGIBSON_HEADLESS", 'False').lower() in ('true', '1', 't'))
|
||||
|
||||
# Whether to use extra settings (verboseness, extra GUI features) for debugging
|
||||
gm.DEBUG = True
|
||||
|
|
Loading…
Reference in New Issue