diff --git a/Home.md b/Home.md index 580660b..bb2a652 100644 --- a/Home.md +++ b/Home.md @@ -4,4 +4,7 @@ Welcome to the rd-blender-docker wiki :wave: - [Getting started](https://github.com/nytimes/rd-blender-docker/wiki/Getting-started) - [Installing with GPU support](https://github.com/nytimes/rd-blender-docker/wiki/Installing-with-GPU-support) - [Using the Blender GUI in containers](https://github.com/nytimes/rd-blender-docker/wiki/Using-the-Blender-GUI-in-containers) -- [Using addons inside containers](https://github.com/nytimes/rd-blender-docker/wiki/Using-addons-inside-containers) \ No newline at end of file +- [Using addons inside containers](https://github.com/nytimes/rd-blender-docker/wiki/Using-addons-inside-containers) + +### Community Guides +- [Using with VSCode and Remote-Containers](https://github.com/nytimes/rd-blender-docker/wiki/Using-with-VSCode-and-Remote-Containers.md) \ No newline at end of file diff --git a/Using-with-VSCode-and-Remote-Containers.md b/Using-with-VSCode-and-Remote-Containers.md new file mode 100644 index 0000000..2334301 --- /dev/null +++ b/Using-with-VSCode-and-Remote-Containers.md @@ -0,0 +1,78 @@ +### Instructions +1. Create a project folder and open it in VS Code. Add a `.devcontainer` folder. +2. Create a `devcontainer.json` file inside it with the content as shown below. +2. Also create an empty `.config/blender` folder. +2. Execute the container by pressing `Ctrl+⇧Shift+P` and run the command `Remote-Containers: Reopen in Container`. +3. From the integrated terminal, run `blender`. + +### Folder structure +This is the folder structure before running the container. +``` +. +├── .devcontainer +│ └── devcontainer.json +│ ├── .config +│ │ └── blender +├── Docker (Not required) +│ └── Dockerfile +``` + +
+ Folder structure after execution +After running the container once, including running Blender, the folder structure should look something similar to this: + +``` + . +├── blender_file.blend +├── .devcontainer +│ ├── .config +│ │ └── blender +│ │ └── 2.92 +│ │ └── config +│ │ ├── platform_support.txt +│ │ ├── recent-files.txt +│ │ └── userpref.blend +│ └── devcontainer.json +├── Docker +│ └── Dockerfile +``` + +
+ + +### `devcontainer.json` +```javascript +{ + "name": "blender", + //// Use this if you use a custom image. + //"build": { + // "dockerfile": "../Docker/Dockerfile", + // }, + // Use this if you only need to run the image directly. + "image": "nytimes/blender:latest", + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + + "workspaceMount": "source=${localWorkspaceFolder},target=/root/${localWorkspaceFolderBasename},type=bind", + "workspaceFolder": "/root/${localWorkspaceFolderBasename}", + // We also mount the config folder from the host system. This way, settings + // inside the container are kept between runs. + "mounts": [ + "source=${localWorkspaceFolder}/.devcontainer/.config/blender,target=/root/.config/blender/,type=bind" + ], + "runArgs": [ + "-it", + "--rm", // Removes the container on exit. Remove this if you want the container to keep running. + "--gpus", "all", + "-v", "/tmp/.X11-unix:/tmp/.X11-unix:rw", + "-v", "/tmp/.docker.xauth:/tmp/.docker.xauth:rw", + "-e", "DISPLAY=${localEnv:DISPLAY}", + "-e", "XAUTHORITY=/tmp/.docker.xauth", + "--device", "/dev/dri/card0:/dev/dri/card0" + ], + "extensions": [] +} +``` + +> See [PR](https://github.com/nytimes/rd-blender-docker/issues/26) for more information about this guide \ No newline at end of file