Skip to content

Commit

Permalink
feat: added devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
ABeltramo committed Aug 13, 2024
1 parent 126a322 commit 00360fa
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .devcontainer/dev-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e
export DEBIAN_FRONTEND=noninteractive

apt-get update

# Install debugger
apt-get install -y gdb

# Install wayland-protocols
apt-get install -y wayland-protocols

# Build and install nvtop
apt-get install -y libdrm-dev libsystemd-dev libncurses5-dev libncursesw5-dev

This comment has been minimized.

Copy link
@shocklateboy92

shocklateboy92 Aug 13, 2024

Member

Maybe add a check if there is an Nvidia GPU exposed to this container?
Otherwise it's a waste going through all this.

This comment has been minimized.

Copy link
@ABeltramo

ABeltramo Aug 15, 2024

Author Member

Despite the name nvtop supports Nvidia, AMD and Intel 😉 ! Not sure if we can have a way to specify optional additional tools, though..

cd /tmp/
git clone https://github.com/Syllo/nvtop.git
mkdir -p nvtop/build && cd nvtop/build
CXX=/usr/bin/clang++ cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON -DINTEL_SUPPORT=ON
cmake --build . --target install --config Release

# Setup nvidia
bash /etc/cont-init.d/30-nvidia.sh
69 changes: 69 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "wolf-dev",
"build": {
"context": "..",
"dockerfile": "../docker/wolf.Dockerfile",
"target": "wolf-builder"
},
"postStartCommand": "bash /workspaces/wolf/.devcontainer/dev-setup.sh",
"features": {
"ghcr.io/nils-geistmann/devcontainers-features/zsh:0": {
"plugins": [
"git",
"zsh-autosuggestions",
"history",
"docker"
]
},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"moby": true,
"installDockerBuildx": false
}
},
"runArgs": [
"--network=host",
"-v",
"/tmp/sockets:/tmp/sockets:rw",
"-v",
"/etc/wolf:/etc/wolf:rw",
"-v",
"/run/udev:/run/udev:ro",
"--rm"
],
"hostRequirements": {
"gpu": true
},
"privileged": true,
"containerEnv": {
"NVIDIA_DRIVER_CAPABILITIES": "all",
"NVIDIA_VISIBLE_DEVICES": "all"
},
"remoteEnv": {
"XDG_RUNTIME_DIR": "/tmp/sockets",
"WOLF_LOG_LEVEL": "DEBUG",
"HOST_APPS_STATE_FOLDER": "/etc/wolf",
"WOLF_CFG_FILE": "/etc/wolf/cfg/config.toml",
"WOLF_PRIVATE_KEY_FILE": "/etc/wolf/cfg/key.pem",
"WOLF_PRIVATE_CERT_FILE": "/etc/wolf/cfg/cert.pem",
"WOLF_PULSE_IMAGE": "ghcr.io/games-on-whales/pulseaudio:master",
"WOLF_RENDER_NODE": "/dev/dri/renderD128",
"WOLF_STOP_CONTAINER_ON_EXIT": "TRUE",
"WOLF_DOCKER_SOCKET": "/var/run/docker.sock",
"WOLF_DOCKER_FAKE_UDEV_PATH": "/wolf/fake-udev",
"RUST_BACKTRACE": "full",
"RUST_LOG": "INFO",
"GST_DEBUG": "2",
"CMAKE_GENERATOR": "Ninja"
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack",
"ms-azuretools.vscode-docker",
"github.vscode-github-actions",
"jeff-hykin.better-cpp-syntax",
"tamasfe.even-better-toml"
]
}
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ DartConfiguration.tcl
.run/
target
Cargo.lock

build/
.clj-kondo
.lsp

0 comments on commit 00360fa

Please sign in to comment.