Add VSCode remote container community guide

master
Or Fleisher 2021-06-22 09:44:30 -04:00
rodzic 0efaaa5c08
commit 7d86463f62
2 zmienionych plików z 82 dodań i 1 usunięć

@ -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)
- [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)

@ -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
```
<details markdown=1>
<summary>Folder structure after execution</summary>
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
```
</details>
### `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