Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MISC] Add minimal Dockerfile #198

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM pytorch/pytorch:2.5.1-cuda12.1-cudnn9-devel
ARG DEBIAN_FRONTEND=noninteractive

# RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

RUN apt update && apt install -y \
git \
vim \
wget \
curl \
libgl1-mesa-glx \
libegl-dev \
libxrender1 \
libglib2.0-0 \
ffmpeg \
libgtk2.0-dev \
pkg-config \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*

COPY . /workspace
WORKDIR /workspace

RUN pip install --upgrade --no-cache-dir pip && \
pip install --no-cache-dir PyOpenGL==3.1.6 && \
pip install -e . --no-cache-dir
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ You also need to install **PyTorch** following the [official instructions](https

If you would like to try out the latest version, we suggest you to git clone from the repo and do `pip install -e .` instead of via PyPI.

### Docker Installation

You can use the Dockerfile provided in the repository to build a docker image:

```bash
docker build -t genesis .
```

And then run the examples inside the docker image:

```bash
xhost +local:root # Allow the container to access the display

docker run --gpus all --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix genesis python examples/tutorials/hello_genesis.py

# Or with docker-compose
docker compose up
```

You need to install [Docker](https://www.docker.com/) and [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) to be able to run the container with GPU support.

### Documentation

Please refer to our [documentation site (English)](https://genesis-world.readthedocs.io/en/latest/user_guide/index.html) / [(Chinese)](https://genesis-world.readthedocs.io/zh-cn/latest/user_guide/index.html) for detailed installation steps, tutorials and API references.
Expand Down
21 changes: 21 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,27 @@ pip install genesis-world # 需要 Python >=3.9;

您还需要按照 [官方说明](https://pytorch.org/get-started/locally/) 安装 **PyTorch**。

### Docker 安装

您可以使用我们提供的 Dockerfile 构建 Docker 镜像:

```bash
docker build -t genesis .
```

然后在 Docker 镜像中运行示例:

```bash
xhost +local:root # 允许容器访问显示

docker run --gpus all --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix genesis python examples/tutorials/hello_genesis.py

# 或使用 docker-compose
docker compose up
```

您需要安装 [Docker](https://www.docker.com/) 和 [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) 以便在容器中使用 GPU。

### 文档

请参阅我们的 [文档网站(英文)](https://genesis-world.readthedocs.io/en/latest/user_guide/index.html)/[(中文)](https://genesis-world.readthedocs.io/zh-cn/latest/user_guide/index.html)以获取详细的安装步骤、教程和 API 参考。
Expand Down
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
genesis:
build:
context: .
dockerfile: Dockerfile
image: genesis:latest
runtime: nvidia
environment:
- DISPLAY=${DISPLAY}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
command: python examples/tutorials/hello_genesis.py
deploy:
resources:
reservations:
devices:
- capabilities: [ gpu ]