Skip to content

Commit 4b4bf00

Browse files
committed
devcontainer: based on nvidia images
1 parent f382f52 commit 4b4bf00

2 files changed

Lines changed: 65 additions & 38 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04
2+
ARG VARIANT="noble"
3+
FROM nvidia/cuda:13.2.1-devel-ubuntu24.04
4+
#FROM buildpack-deps:${VARIANT}-curl
5+
6+
LABEL dev.containers.features="common"
7+
8+
ARG VARIANT
9+
RUN if [ "$VARIANT" = "noble" ] || [ "$VARIANT" = "resolute" ]; then \
10+
if id "ubuntu" &>/dev/null; then \
11+
echo "Deleting user 'ubuntu' for $VARIANT" && userdel -f -r ubuntu || echo "Failed to delete ubuntu user for $VARIANT"; \
12+
else \
13+
echo "User 'ubuntu' does not exist for $VARIANT"; \
14+
fi; \
15+
fi
16+
17+
# [Optional] Uncomment this section to install additional OS packages.
18+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
19+
&& apt-get -y install --no-install-recommends \
20+
git \
21+
libopenmpi-dev \
22+
cmake \
23+
libhdf5-dev \
24+
hdf5-tools \
25+
less \
26+
python3-pip \
27+
libpython3-dev \
28+
clang-format \
29+
ninja-build
30+
31+
# Local fix for issue with timezone data at 'buildpack-deps'. Ref# https://github.com/devcontainers/images/issues/1709
32+
RUN apt-get update \
33+
&& export DEBIAN_FRONTEND=noninteractive \
34+
&& apt-get -y reinstall --no-install-recommends tzdata \
35+
&& echo "Etc/UTC" > /etc/timezone \
36+
&& rm -rf /var/lib/apt/lists/*
37+
38+

.devcontainer/devcontainer.json

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,48 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
33
{
4-
"name": "Ubuntu",
4+
"name": "psc-ubuntu",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/base:jammy",
7-
// Features to add to the dev container. More info: https://containers.dev/features.
6+
"build": {
7+
"dockerfile": "Dockerfile",
8+
"context": "."
9+
},
810
"features": {
9-
// "ghcr.io/devcontainers/features/anaconda:1": {
10-
// "version": "latest"
11+
"ghcr.io/devcontainers/features/common-utils:2": {
12+
"installZsh": "true",
13+
"username": "vscode",
14+
"userUid": "1000",
15+
"userGid": "1000",
16+
"upgradePackages": "true"
17+
},
18+
// "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
19+
// "packages": [
20+
// ]
1121
// },
12-
"ghcr.io/itsmechlark/features/act:1": {
13-
"version": "latest"
14-
},
15-
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
16-
"packages": [
17-
"csh",
18-
"gawk",
19-
"gfortran",
20-
"libopenmpi-dev",
21-
"autoconf",
22-
"automake",
23-
"libtool",
24-
"cmake",
25-
"libhdf5-dev",
26-
"hdf5-tools",
27-
"less",
28-
"python3-pip",
29-
"libpython3-dev",
30-
"clang-format",
31-
"ninja-build",
32-
"findent",
33-
"pandoc"
34-
]
35-
},
36-
"ghcr.io/unh-hpc/features/adios2:0.0.2": {}
37-
},
38-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
22+
23+
// "ghcr.io/devcontainers/features/git:1": {
24+
// "version": "latest",
25+
// "ppa": "false"
26+
// }
27+
},
28+
// Feat``ures to add to the dev container. More info: https://containers.dev/features.
29+
` // Use 'forwardPorts' to make a list of ports inside the container available locally.
3930
// "forwardPorts": [],
4031
// Use 'postCreateCommand' to run commands after the container is created.
41-
"postCreateCommand": "pip install uv && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && curl -fsSL https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null && sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit nvidia-cuda-toolkit && sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && echo 'export OPENGGCMDIR=/workspaces/openggcm' >> /home/vscode/.bashrc && echo 'shopt -u progcomp' >> /home/vscode/.bashrc && echo 'alias ll=\"ls -lrt\"' >> /home/vscode/.bashrc",
32+
// "postCreateCommand": "curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && curl -fsSL https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null && sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit nvidia-cuda-toolkit && echo 'shopt -u progcomp' >> /home/vscode/.bashrc && echo 'alias ll=\"ls -lrt\"' >> /home/vscode/.bashrc",
33+
"postCreateCommand": "echo export CMAKE_PREFIX_PATH=/usr/local/cuda/lib64/cmake >> ~/.bashrc",
4234
// "echo export OPENGGCMDIR=/workspaces/openggcm >> ~/.zshrc; echo PATH=$HOME/bin:$PATH >> ~/.zshrc",
4335
"customizations": {
4436
"vscode": {
4537
"extensions": [
4638
"ms-vscode.cmake-tools",
4739
"ms-vscode.cpptools-extension-pack",
48-
"fortran-lang.linter-gfortran",
4940
"ms-toolsai.jupyter",
50-
"ms-python.python",
51-
"Github.vscode-pull-request-github",
52-
"tamasfe.even-better-toml",
53-
"charliermarsh.ruff"
41+
"ms-python.python"
5442
]
5543
}
5644
}
45+
5746
// Configure tool-specific properties.
5847
// "customizations": {},
5948
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.

0 commit comments

Comments
 (0)