Commit 88dd1e11 authored by hhzhang16's avatar hhzhang16 Committed by GitHub
Browse files

feat: add devcontainer to dynamo for Ubuntu 24.04 use (#466)

parent 1ab4a7dd
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 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 ubuntu:24.04
# Avoid prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
python3-dev \
python3-pip \
python3-venv \
libucx0 \
pkg-config \
libssl-dev \
jq \
wget \
sudo \
protobuf-compiler \
bash \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
ARG USERNAME=vscode
ARG USER_UID=2008
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Set bash as default shell for the user
RUN chsh -s /bin/bash $USERNAME
# Set up Docker CLI
RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
RUN usermod -aG docker $USERNAME
# Set the working directory
WORKDIR /workspaces/dynamo
# Switch to non-root user
USER $USERNAME
# Install Rust for the vscode user
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile default -y \
&& . $HOME/.cargo/env
ENV PATH="/home/$USERNAME/.cargo/bin:${PATH}"
\ No newline at end of file
{
"$schema": "https://json-schema.org/draft-07/schema#",
"copyright": [
"SPDX-FileCopyrightText: Copyright (c) 2025 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": "NVIDIA Dynamo Development",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"runArgs": [
"--gpus=all"
],
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"github.copilot",
"ms-azuretools.vscode-docker"
],
"settings": {
"python.defaultInterpreterPath": "/workspaces/ai-dynamo/venv/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"editor.formatOnSave": true,
"rust-analyzer.checkOnSave.command": "clippy"
}
}
},
"updateRemoteUserUID": true,
"postCreateCommand": "/bin/bash .devcontainer/post-create.sh",
"postStartCommand": "echo 'source /workspaces/ai-dynamo/venv/bin/activate' >> ~/.bashrc",
"remoteUser": "vscode"
}
\ No newline at end of file
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2025 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.
set -e
# Create and activate Python virtual environment
python3 -m venv venv
. ./venv/bin/activate
# Build Rust components first
cargo build --release
# Install Dynamo with all dependencies
pip install -e .[all]
# Install development tools
pip install pytest isort mypy pylint pre-commit
echo "Development environment setup complete!"
\ No newline at end of file
...@@ -77,8 +77,6 @@ __pycache__/ ...@@ -77,8 +77,6 @@ __pycache__/
*$py.class *$py.class
*.so *.so
**/.devcontainer
### Helm ### ### Helm ###
*.tgz *.tgz
Chart.lock Chart.lock
......
...@@ -50,6 +50,19 @@ pip install ai-dynamo[all] ...@@ -50,6 +50,19 @@ pip install ai-dynamo[all]
> [!NOTE] > [!NOTE]
> TensorRT-LLM Support is currently available on a [branch](https://github.com/ai-dynamo/dynamo/tree/dynamo/trtllm_llmapi_v1/examples/trtllm#building-the-environment) > TensorRT-LLM Support is currently available on a [branch](https://github.com/ai-dynamo/dynamo/tree/dynamo/trtllm_llmapi_v1/examples/trtllm#building-the-environment)
### Development Environment
For a consistent development environment, you can use the provided devcontainer configuration. This requires:
- [Docker](https://www.docker.com/products/docker-desktop)
- [VS Code](https://code.visualstudio.com/) with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
To use the devcontainer:
1. Open the project in VS Code
2. Click on the button in the bottom-left corner
3. Select "Reopen in Container"
This will build and start a container with all the necessary dependencies for Dynamo development.
### Running and Interacting with an LLM Locally ### Running and Interacting with an LLM Locally
To run a model and interact with it locally you can call `dynamo To run a model and interact with it locally you can call `dynamo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment