Repository navigation
feat: add standalone Gym Docker container #2161
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
3273e78
feat: add standalone Gym Docker container
kajalj22 1025125
fix: remove pull_request trigger from build-container workflow
kajalj22 82d97df
fix: align Dockerfile with RL repo patterns and address review comments
kajalj22 44bb797
fix: remove user-controlled VLLM_VERSION build arg
kajalj22 3ef2546
feat: add vllm optional extra and install it in the container
kajalj22 18688bb
fix: remove dead git fetch --unshallow and trailing WORKDIR
kajalj22 82e559a
fix: pass build-contexts to inject local source into Docker build
kajalj22 9002bcb
feat: sync vllm versions, add flashinfer pin, add prefetch build arg
kajalj22 04cc506
fix: use uv pip install -e . in prefetch loop instead of uv sync
kajalj22 85ec2dc
feat: add smoke test job to build-container workflow
kajalj22 e871791
fix: drop redundant 'gym' in smoke test docker run
kajalj22 173cccb
feat: pin flashinfer-python==0.6.14 in local_vllm_model and genrm_model
kajalj22 5afbaef
refactor: call FW-CI-templates directly, bump to v0.78.0
kajalj22 6c760ab
fix: add id-token: write permission to test job for Azure OIDC login
kajalj22 d2e396c
fix: pin runner to linux-amd64-cpu16 for v0.78.0 compatibility
kajalj22 c32e401
fix: add environment: nemo-ci to test job for Azure OIDC
kajalj22 c25e520
fix: remove hardcoded version assertions from smoke test
kajalj22 a975601
fix: use --entrypoint python in smoke test docker run
kajalj22 8d319ef
fix: revert vllm to 0.20.0, update flashinfer to match
kajalj22 18838ee
refactor: simplify build-container to build-only, no push
kajalj22 8366c38
feat: add pull_request trigger on ubuntu-latest for PR build checks
kajalj22 2524a0b
Merge branch 'main' into add-docker-container
kajalj22 6746746
Merge branch 'main' into add-docker-container
kajalj22 ee67933
remove: drop NEMO_GYM_PREFETCH_SERVERS from Dockerfile
kajalj22 8405b97
Merge branch 'add-docker-container' of https://github.com/NVIDIA-NeMo…
kajalj22 7c8b07d
restore: re-add NEMO_GYM_PREFETCH_SERVERS to Dockerfile
kajalj22 37c3aaf
Merge branch 'main' into add-docker-container
kajalj22 5c4b5bf
feat: add gym env prefetch for baking server venvs into the container…
kajalj22 ab2737b
Merge branch 'main' into add-docker-container
kajalj22 abf739f
Merge branch 'main' into add-docker-container
kajalj22 3e5d035
Merge branch 'main' into add-docker-container
kajalj22 7de5ee5
Merge branch 'main' into add-docker-container
kajalj22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # 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: Build container | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - docker/Dockerfile | ||
| - pyproject.toml | ||
| - uv.lock | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - docker/Dockerfile | ||
| - pyproject.toml | ||
| - uv.lock | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 | ||
|
|
||
| - name: Build | ||
| uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5 | ||
| with: | ||
| context: . | ||
| file: docker/Dockerfile | ||
| build-contexts: nemo-gym=. | ||
| target: release | ||
| push: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| # Usage: | ||
| # Self-contained build (default: builds from main): | ||
| # docker buildx build -f docker/Dockerfile --tag <registry>/nemo-gym:latest --push . | ||
| # | ||
| # Self-contained build (specific git ref): | ||
| # docker buildx build -f docker/Dockerfile --build-arg GYM_GIT_REF=v0.4.0 \ | ||
| # --tag <registry>/nemo-gym:v0.4.0 --push . | ||
| # | ||
| # Local source override: | ||
| # docker buildx build --build-context nemo-gym=. -f docker/Dockerfile \ | ||
| # --tag <registry>/nemo-gym:latest --push . | ||
| # | ||
|
|
||
| ARG BASE_IMAGE=nvcr.io/nvidia/cuda-dl-base:26.03-cuda13.2-devel-ubuntu24.04 | ||
|
|
||
| # Source stage: clones Gym from GitHub. Override with --build-context nemo-gym=. | ||
| # to inject a local checkout instead. | ||
| FROM scratch AS nemo-gym | ||
| ARG GYM_GIT_REF=main | ||
| ADD --keep-git-dir=true https://github.com/NVIDIA-NeMo/Gym.git#${GYM_GIT_REF} / | ||
|
|
||
| FROM ${BASE_IMAGE} AS base | ||
| ENV NEMO_GYM_CONTAINER=1 | ||
| USER root | ||
|
|
||
| RUN <<"EOF" bash -exu -o pipefail | ||
| export DEBIAN_FRONTEND=noninteractive | ||
| export TZ=America/Los_Angeles | ||
|
|
||
| apt-get update | ||
| apt-get install -y --no-install-recommends \ | ||
| jq \ | ||
| curl \ | ||
| git \ | ||
| rsync \ | ||
| wget \ | ||
| less \ | ||
| vim | ||
|
|
||
| apt-get clean | ||
| rm -rf /var/lib/apt/lists/* | ||
| EOF | ||
|
|
||
| ARG UV_VERSION=0.11.6 | ||
| ARG PYTHON_VERSION=3.12.11 | ||
| ENV PATH="/root/.local/bin:$PATH" | ||
| RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh && \ | ||
| uv python install ${PYTHON_VERSION} | ||
|
|
||
| ENV RAY_USAGE_STATS_ENABLED=0 | ||
|
|
||
|
|
||
| FROM base AS hermetic | ||
|
|
||
| WORKDIR /opt/nemo-gym | ||
|
|
||
| ARG BASE_IMAGE | ||
| ARG UV_VERSION | ||
|
|
||
| ENV UV_PROJECT_ENVIRONMENT=/opt/nemo_gym_venv | ||
| ENV UV_LINK_MODE=copy | ||
|
|
||
| # Copy only dependency metadata first for layer caching. | ||
| COPY --from=nemo-gym pyproject.toml uv.lock ./ | ||
| COPY --from=nemo-gym nemo_gym/__init__.py nemo_gym/package_info.py ./nemo_gym/ | ||
|
|
||
| RUN uv venv --seed && \ | ||
|
kajalj22 marked this conversation as resolved.
Resolved
|
||
| uv sync --link-mode symlink --locked --extra vllm --no-install-project | ||
|
|
||
| ENV PATH="/opt/nemo_gym_venv/bin:$PATH" | ||
|
|
||
|
|
||
| FROM hermetic AS release | ||
|
|
||
| ARG NEMO_GYM_PREFETCH_CONFIGS="" | ||
| ARG NEMO_GYM_COMMIT | ||
| ARG NVIDIA_BUILD_ID | ||
| ARG NVIDIA_BUILD_REF | ||
| ARG RC_DATE=00.00 | ||
| ARG TARGETARCH | ||
| ENV NEMO_GYM_COMMIT=${NEMO_GYM_COMMIT:-<unknown>} | ||
| ENV NVIDIA_BUILD_ID=${NVIDIA_BUILD_ID:-<unknown>} | ||
| ENV NVIDIA_BUILD_REF=${NVIDIA_BUILD_REF:-<unknown>} | ||
| LABEL com.nvidia.build.id="${NVIDIA_BUILD_ID}" | ||
| LABEL com.nvidia.build.ref="${NVIDIA_BUILD_REF}" | ||
|
|
||
| # Copy full source. Exclude pyproject.toml and uv.lock since they are | ||
| # already present from the hermetic stage. | ||
| COPY --from=nemo-gym --exclude=pyproject.toml --exclude=uv.lock . /opt/nemo-gym | ||
|
|
||
| # Install the nemo-gym project itself along with the vllm extra. | ||
| RUN UV_LINK_MODE=symlink uv sync --locked --extra vllm | ||
|
ananthsub marked this conversation as resolved.
Resolved
|
||
|
|
||
| # Optional: pre-warm per-server venvs at build time so they are ready at runtime. | ||
| # Pass --build-arg NEMO_GYM_PREFETCH_CONFIGS="path/to/config1.yaml,path/to/config2.yaml" | ||
| # Uses 'gym env prefetch' which accepts the same config format as 'gym env start', | ||
| # installs each server's venv serially, and exits without starting any server process. | ||
| RUN <<"EOF" bash -exu | ||
| if [[ -n "${NEMO_GYM_PREFETCH_CONFIGS:-}" ]]; then | ||
| gym env prefetch "+config_paths=[${NEMO_GYM_PREFETCH_CONFIGS}]" | ||
| fi | ||
| EOF | ||
|
|
||
| ENTRYPOINT ["gym"] | ||
| CMD ["--help"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.