1
Fork 0

fix: Use local dirname

Use local dirname for devcontainer mounting
This commit is contained in:
Tibo De Peuter 2026-03-19 11:38:01 +01:00
parent cb5a6fbd87
commit ff462d867a
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
2 changed files with 16 additions and 13 deletions

View file

@ -17,13 +17,14 @@ ENV LD_LIBRARY_PATH=/usr/lib/nvidia
ENV NVIDIA_VISIBLE_DEVICES=all ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics
# Set the standardized workspace path # Set the workspace path (defaults to /workspaces/project but can be overridden)
ENV WORKSPACE_PATH=/workspaces/project ARG WORKSPACE_PATH=/workspaces/project
ENV WORKSPACE_PATH=$WORKSPACE_PATH
ENV PATH="$WORKSPACE_PATH/.venv/bin:$PATH" ENV PATH="$WORKSPACE_PATH/.venv/bin:$PATH"
# Ensure the workspace directory exists and is owned by the vscode user # Ensure the workspace and .venv directories exist and are owned by the vscode user
# This prevents permission errors when the postCreateCommand runs uv sync # This prevents permission errors when the postCreateCommand runs uv sync
RUN mkdir -p $WORKSPACE_PATH && chown vscode:vscode $WORKSPACE_PATH RUN mkdir -p $WORKSPACE_PATH/.venv && chown -R vscode:vscode $WORKSPACE_PATH
USER vscode USER vscode
WORKDIR $WORKSPACE_PATH WORKDIR $WORKSPACE_PATH

View file

@ -2,10 +2,12 @@
"name": "Brittle Star JAX/CUDA", "name": "Brittle Star JAX/CUDA",
"build": { "build": {
"dockerfile": "Dockerfile", "dockerfile": "Dockerfile",
"context": ".." "context": "..",
"args": {
"WORKSPACE_PATH": "/workspaces/${localWorkspaceFolderBasename}"
}
}, },
// Standardize workspace folder to /workspaces/project for IDE parity "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"workspaceFolder": "/workspaces/project",
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions": [ "extensions": [
@ -15,10 +17,10 @@
"ms-toolsai.jupyter" "ms-toolsai.jupyter"
], ],
"settings": { "settings": {
"python.defaultInterpreterPath": "/workspaces/project/.venv/bin/python", "python.defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python",
"python.analysis.localRoot": "/workspaces/project", "python.analysis.localRoot": "${containerWorkspaceFolder}",
"python.analysis.extraPaths": [ "python.analysis.extraPaths": [
"/workspaces/project/.venv/lib/python3.12/site-packages" "${containerWorkspaceFolder}/.venv/lib/python3.12/site-packages"
] ]
} }
}, },
@ -37,11 +39,11 @@
], ],
// Ensure the .venv persists using a named volume for performance and parity // Ensure the .venv persists using a named volume for performance and parity
"mounts": [ "mounts": [
"source=brittle_star-venv,target=/workspaces/project/.venv,type=volume" "source=${localWorkspaceFolderBasename}-venv,target=${containerWorkspaceFolder}/.venv,type=volume"
], ],
// Invoke the hardware-aware sync script // Invoke the hardware-aware sync script
"postCreateCommand": "bash .devcontainer/post-create.sh", "postCreateCommand": "bash ./.devcontainer/post-create.sh",
"features": { "features": {
"ghcr.io/devcontainers/features/common-utils:1": {} "ghcr.io/devcontainers/features/common-utils:1": {}
} }
} }