Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devcontainer Updates #297

Merged
merged 6 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .devcontainer/conda/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM rapidsai/devcontainers:23.04-cuda11.8-mambaforge-ubuntu22.04 AS base

ENV PATH="${PATH}:/workspaces/mrc/.devcontainer/bin"
92 changes: 92 additions & 0 deletions .devcontainer/conda/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{
"name": "mrc-dev",
"build": {
"dockerfile": "Dockerfile"
},
"hostRequirements": {
"gpu": true
},
"capAdd":[
"SYS_NICE",
"SYS_PTRACE"
],
"securityOpt": [
"seccomp=unconfined"
],
"runArgs": [
"--network=host"
],
"containerEnv": {
"HOST_MRC_ROOT": "${localWorkspaceFolder}",
"MRC_ROOT": "${containerWorkspaceFolder}",
"DEFAULT_CONDA_ENV": "mrc",
"MAMBA_NO_BANNER": "1",
"VAULT_HOST": "https://vault.ops.k8s.rapids.ai"
},
"initializeCommand": [ "${localWorkspaceFolder}/.devcontainer/conda/initialize-command.sh" ],
"remoteUser": "coder",
"mounts": [
{
"type": "bind",
"source": "${localWorkspaceFolder}/.cache/conda/envs",
"target": "/home/coder/.conda/envs"
},
{
"type": "bind",
"source": "${localWorkspaceFolder}/../.conda/pkgs",
"target": "/home/coder/.conda/pkgs"
},
{
"type": "bind",
"source": "${localWorkspaceFolder}/../.config", // parent folder because sister repos are sibling dirs
"target": "/home/coder/.config"
},
{
"type": "bind",
"source": "${localWorkspaceFolder}/.devcontainer/opt/mrc",
"target": "/opt/mrc"
},
],
"features": {
"ghcr.io/devcontainers/features/dotnet:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"eamodio.gitlens",
"formulahendry.terminal",
"hbenl.vscode-test-explorer",
"josetr.cmake-language-support-vscode",
"llvm-vs-code-extensions.vscode-clangd",
"matepek.vscode-catch2-test-adapter",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools-themes",
"ms-vscode.cpptools",
"ms-vscode.test-adapter-converter",
"xaver.clang-format"
],
"settings": {
"cmake.cmakePath": "/tmp/.current-conda-env/bin/cmake",
"cmake.languageSupport.dotnetPath": "/usr/bin/dotnet",
"C_Cpp.intelliSenseEngine": "disabled",
"python.terminal.activateEnvironment": false
}
}
},
}
21 changes: 21 additions & 0 deletions .devcontainer/conda/initialize-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# create the parent conda folder so it's found when mounting
mkdir -p ../.conda

# create a config directory if it does not exist so it's found when mounting
mkdir -p ../.config
8 changes: 3 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@
"hostRequirements": {
"gpu": true
},
"initializeCommand": [ "./.devcontainer/init.sh" ],
"initializeCommand": [ "${localWorkspaceFolder}/.devcontainer/initialize-command.sh" ],
"mounts": [
"source=${localEnv:HOME}/.config,target=/home/${localEnv:USER}/.config,type=bind",
// Mount the necessary files for GDB pretty-printing to work
"source=${localWorkspaceFolder}/.devcontainer/home/.gdbinit,target=/home/${localEnv:USER}/.gdbinit,type=bind",
"source=${localWorkspaceFolder}/.devcontainer/home/.config/gdb,target=/home/${localEnv:USER}/.config/gdb,type=bind",
// Mount the Github CLI config directory to allow using the Github CLI
"source=${localEnv:HOME}/.config/gh,target=/home/${localEnv:USER}/.config/gh,type=bind",
"source=${localWorkspaceFolder}/.devcontainer/opt/mrc/etc/.gdbinit,target=/home/${localEnv:USER}/.gdbinit,type=bind",
],
"features": {
"ghcr.io/devcontainers/features/git-lfs": {}
Expand Down
3 changes: 0 additions & 3 deletions .devcontainer/home/.gdbinit

This file was deleted.

21 changes: 21 additions & 0 deletions .devcontainer/initialize-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# create the parent conda folder so it's found when mounting
mkdir -p ../.conda

# create a config directory if it does not exist so it's found when mounting
mkdir -p ../.config
33 changes: 33 additions & 0 deletions .devcontainer/opt/mrc/bin/post-attach-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Ensure our ~/.config directory has the correct permissions. If ~/.config did
# not exist, and you mount ~/.config/gh from the host, then ~/.config will be
# created with root permissions which can break things

conda_env_find(){
conda env list | grep "${@}" >/dev/null 2>/dev/null
}

ENV_NAME=${ENV_NAME:-mrc}

sed -ri "s/conda activate base/conda activate $ENV_NAME/g" ~/.bashrc;

if conda_env_find "${ENV_NAME}" ; \

then mamba env update --name ${ENV_NAME} -f ${MRC_ROOT}/ci/conda/environments/dev_env.yml --prune; \
else mamba env create --name ${ENV_NAME} -f ${MRC_ROOT}/ci/conda/environments/dev_env.yml; \
fi
23 changes: 23 additions & 0 deletions .devcontainer/opt/mrc/bin/update-content-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Ensure our ~/.config directory has the correct permissions. If ~/.config did
# not exist, and you mount ~/.config/gh from the host, then ~/.config will be
# created with root permissions which can break things

if [[ ! -f ~/.config/.gdbinit ]]; then
cp /opt/mrc/etc/.gdbinit ~/.config/.gdbinit
fi
18 changes: 18 additions & 0 deletions .devcontainer/opt/mrc/conda/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM rapidsai/devcontainers:23.04-cuda11.8-mambaforge-ubuntu22.04 AS base

ENV PATH="${PATH}:/workspaces/mrc/.devcontainer/bin"
92 changes: 92 additions & 0 deletions .devcontainer/opt/mrc/conda/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{
"name": "mrc-dev",
"build": {
"dockerfile": "Dockerfile"
},
"hostRequirements": {
"gpu": true
},
"capAdd":[
"SYS_NICE",
"SYS_PTRACE"
],
"securityOpt": [
"seccomp=unconfined"
],
"runArgs": [
"--network=host"
],
"containerEnv": {
"HOST_MRC_ROOT": "${localWorkspaceFolder}",
"MRC_ROOT": "${containerWorkspaceFolder}",
"DEFAULT_CONDA_ENV": "mrc",
"MAMBA_NO_BANNER": "1",
"VAULT_HOST": "https://vault.ops.k8s.rapids.ai"
},
"initializeCommand": [ "${localWorkspaceFolder}/.devcontainer/initialize-command.sh" ],
"remoteUser": "coder",
"mounts": [
{
"type": "bind",
"source": "${localWorkspaceFolder}/.cache/conda/envs",
"target": "/home/coder/.conda/envs"
},
{
"type": "bind",
"source": "${localWorkspaceFolder}/../.conda/pkgs",
"target": "/home/coder/.conda/pkgs"
},
{
"type": "bind",
"source": "${localWorkspaceFolder}/../.config", // parent folder because sister repos are sibling dirs
"target": "/home/coder/.config"
},
{
"type": "bind",
"source": "${localWorkspaceFolder}/.devcontainer/opt/mrc",
"target": "/opt/mrc"
},
],
"features": {
"ghcr.io/devcontainers/features/dotnet:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"eamodio.gitlens",
"formulahendry.terminal",
"hbenl.vscode-test-explorer",
"josetr.cmake-language-support-vscode",
"llvm-vs-code-extensions.vscode-clangd",
"matepek.vscode-catch2-test-adapter",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools-themes",
"ms-vscode.cpptools",
"ms-vscode.test-adapter-converter",
"xaver.clang-format"
],
"settings": {
"cmake.cmakePath": "/tmp/.current-conda-env/bin/cmake",
"cmake.languageSupport.dotnetPath": "/usr/bin/dotnet",
"C_Cpp.intelliSenseEngine": "disabled",
"python.terminal.activateEnvironment": false
}
}
},
}
21 changes: 21 additions & 0 deletions .devcontainer/opt/mrc/conda/initialize-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# create the parent conda folder so it's found when mounting
mkdir -p ../.conda

# create a config directory if it does not exist so it's found when mounting
mkdir -p ../.config
3 changes: 3 additions & 0 deletions .devcontainer/opt/mrc/etc/.gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add-auto-load-safe-path /opt/conda

source /opt/mrc/etc/enable_conda_libstd_pretty_print.py
Loading