|
4 | 4 |
|
5 | 5 | { |
6 | 6 | // Define the container name for easy identification |
7 | | - "name": "L-CAS Humble CUDA-OpenGL Devcontainer", |
| 7 | + "name": "L-CAS Humble CUDA-OpenGL Devcontainer for AOC Fruit Detector", |
8 | 8 |
|
9 | | - // Specify the Docker Compose file(s) required to set up the dev container |
10 | | - "dockerComposeFile": ["../docker-compose.yml"], |
11 | | - "service": "fruit_detector", // Define the main service to use in the container |
| 9 | + // Use Dockerfile directly instead of docker-compose |
| 10 | + "build": { |
| 11 | + "dockerfile": "./Dockerfile", |
| 12 | + "context": "..", |
| 13 | + "target": "final" |
| 14 | + }, |
12 | 15 | "workspaceFolder": "/home/ros/fruit_detector_ws/", // Path to the workspace within the container |
| 16 | + "workspaceMount": "source=${localWorkspaceFolder},target=/home/ros/fruit_detector_ws/src,type=bind", // Mount local workspace into the container |
| 17 | + //"workspaceFolder": "/home/ros/fruit_detector_ws/", // Path to the workspace within the container |
13 | 18 |
|
14 | 19 | // Forward specific ports from the container to the host machine |
15 | 20 | "forwardPorts": [5801], // Port for remote desktop access |
|
26 | 31 | // "postCreateCommand": "sudo src/aoc_fruit_detector/.devcontainer/scripts/post-create.sh'", |
27 | 32 |
|
28 | 33 | // Define environment variables to facilitate mounting local source code |
29 | | - "remoteEnv": { |
30 | | - "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" // Sets local workspace path in the container |
31 | | - }, |
| 34 | + // "remoteEnv": { |
| 35 | + // "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" // Sets local workspace path in the container |
| 36 | + // }, |
32 | 37 |
|
33 | 38 | "remoteUser": "ros", // Set the default user inside the container |
34 | 39 | "updateRemoteUserUID": true, // Align container user UID with host user for permission consistency |
35 | | - "shutdownAction": "stopCompose", // Gracefully stop the Compose environment on shutdown |
| 40 | + |
| 41 | + "capAdd": ["NET_ADMIN"], |
| 42 | + |
| 43 | + // Container environment variables |
| 44 | + "containerEnv": { |
| 45 | + "HOST_USER": "${localEnv:USER}", |
| 46 | + "HOST_HOSTNAME": "${localEnv:HOSTNAME}" |
| 47 | + }, |
| 48 | + |
| 49 | + // Mount additional volumes |
| 50 | + "mounts": [ |
| 51 | + "source=/etc/timezone,target=/etc/timezone,type=bind,readonly", |
| 52 | + "source=/etc/localtime,target=/etc/localtime,type=bind,readonly", |
| 53 | + "source=/media,target=/media,type=bind" |
| 54 | + ], |
| 55 | + |
| 56 | + // Initialize command to set up networking |
| 57 | + "initializeCommand": "echo 'Setting up devcontainer...'", |
| 58 | + "postStartCommand": "/opt/entrypoint.sh /bin/true; ./src/.devcontainer/scripts/post-create.sh", // Run post-create script to set up the environment |
36 | 59 |
|
37 | 60 | // VS Code customizations: Install specific extensions on container startup |
38 | 61 | "customizations": { |
39 | 62 | "vscode": { |
| 63 | + "settings": { |
| 64 | + "git.defaultCloneDirectory": "/home/ros/fruit_detector_ws/src", |
| 65 | + "git.repositorySearchMaxDepth": 2 |
| 66 | + }, |
40 | 67 | "extensions": [ |
41 | 68 | "ms-python.python", // Python support |
42 | 69 | "GitHub.vscode-pull-request-github", // GitHub pull request and issue support |
|
50 | 77 | }, |
51 | 78 |
|
52 | 79 | // Define minimum requirements for the host machine when running this container |
53 | | - // "hostRequirements": { |
54 | | - // "gpu": "optional", // GPU support is optional, useful for CUDA if available |
55 | | - // "cpus": 2, // Minimum 2 CPU cores recommended |
56 | | - // "memory": "8gb" // Minimum 8GB RAM recommended |
57 | | - // } |
| 80 | + "hostRequirements": { |
| 81 | + "gpu": "optional" // GPU support is optional, useful for CUDA if available |
| 82 | + } |
58 | 83 | } |
0 commit comments