Devcontainer: Fix context path and workspace mount (#152880)

## Summary
- Changed the devcontainer context path from '../..' to './' for both CPU and CUDA configurations
- Added workspace mount configuration to properly mount the repository in the container
- Added containerEnv to disable implicit --user pip flag

## Test plan
Test by building and running the devcontainer in VS Code
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152880
Approved by: https://github.com/atalman
This commit is contained in:
Wouter Devriendt
2025-05-06 19:22:25 +00:00
committed by PyTorch MergeBot
parent 08f5371571
commit 200df50c05
2 changed files with 15 additions and 3 deletions

View File

@ -3,7 +3,7 @@
{
"name": "PyTorch - CPU",
"build": {
"context": "../..",
"context": "./",
"dockerfile": "../Dockerfile",
"args": {
"USERNAME": "vscode",
@ -11,6 +11,12 @@
"CLANG_VERSION": ""
}
},
// Mount the full repo only after the container starts
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace/pytorch,type=bind,consistency=cached",
"workspaceFolder": "/workspace/pytorch",
"containerEnv": {
"PIP_USER": "0" // < disable implicit --user
},
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {

View File

@ -3,7 +3,7 @@
{
"name": "PyTorch - CUDA",
"build": {
"context": "../..",
"context": "./",
"dockerfile": "../Dockerfile",
"args": {
"USERNAME": "vscode",
@ -12,7 +12,13 @@
"CLANG_VERSION": ""
}
},
"runArgs": ["--gpus", "all"],
"runArgs": ["--runtime", "nvidia", "--gpus", "all"],
// Mount the full repo only after the container starts
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace/pytorch,type=bind,consistency=cached",
"workspaceFolder": "/workspace/pytorch",
"containerEnv": {
"PIP_USER": "0" // < disable implicit --user
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],