Skip to content

feat(dockerfiles): add minimal Dockerfile.nemo-gym - #1444

Merged
gwarmstrong merged 7 commits into
mainfrom
georgea/add-nemo-gym-dockerfile
May 13, 2026
Merged

gwarmstrong merged 7 commits into
mainfrom
georgea/add-nemo-gym-dockerfile

Conversation

@gwarmstrong

@gwarmstrong gwarmstrong commented May 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds a minimal NeMo Gym runtime container (dockerfiles/Dockerfile.nemo-gym) for running ng_run / ng_collect_rollouts against a pre-hosted or separately-launched policy server.

  • Policy LLM is reached over HTTP; this image only holds Gym orchestration and FastAPI resource/agent servers.
  • BASE_IMAGE defaults to python:3.12-slim-bookworm.
  • GYM_COMMIT pinned to NVIDIA-NeMo/Gym@90770c32 (current main) and pulled hermetically via ADD from GitHub.
  • uv installed to /usr/local/bin so it survives SLURM/pyxis PATH resets.
  • Venv pre-created at /opt/NeMo-Gym/.venv with --copies so it doesn't depend on a uv-managed interpreter path that can vanish during image flattening.
  • Sanity step verifies import nemo_gym and that ng_run / ng_collect_rollouts are on PATH inside the baked venv.

Summary by CodeRabbit

  • New Features

    • Adds a lightweight, containerized NeMo-Gym runtime image with a Python 3.12 virtual environment, pre-synced dependencies, and configured runtime path.
  • Configuration

    • Example/local cluster configuration and default container mapping updated to include the new NeMo-Gym container.
  • Tests

    • Local test configuration updated to exercise the new NeMo-Gym container.

Review Change Stack

Adds a minimal NeMo Gym runtime container for running ng_run /
ng_collect_rollouts against a pre-hosted or separately-launched policy
server. No torch, vLLM, Megatron, or CUDA in this image — the policy LLM
is reached over HTTP; this container only holds Gym orchestration and
FastAPI resource/agent servers.

- BASE_IMAGE defaults to python:3.12-slim-bookworm
- GYM_COMMIT pinned to NVIDIA-NeMo/Gym@90770c32 (current main) and
  pulled hermetically via ADD from GitHub
- uv installed to /usr/local/bin so it survives SLURM/pyxis PATH resets
- Venv pre-created at /opt/NeMo-Gym/.venv with --copies so it doesn't
  depend on a uv-managed interpreter path that can vanish during image
  flattening
- Sanity check confirms nemo_gym import and ng_run / ng_collect_rollouts
  are on PATH inside the baked venv

Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
Adds a dedicated workflow that builds dockerfiles/Dockerfile.nemo-gym
on PRs that modify the dockerfile (or the workflow itself), with
registry-cache push/pull to GHCR so subsequent builds reuse layers.

Path-filtered rather than added to tests.yml because the nemo-gym image
is not used by pytest — gating every PR on this build would be wasted
CI time. Matches the policy used for the other non-test dockerfiles
(nemo-rl, vllm, verl, megatron) which are also not built per-PR.

Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
This reverts commit 0d2a4ef.

Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a new Dockerfile for a minimal NeMo-Gym runtime (pinned source, Python 3.12 venv, uv-managed deps, sanity checks) and registers the nemo-gym container in library defaults, example local cluster config, and a GPU test manifest.

Changes

NeMo-Gym Docker Runtime Setup

Layer / File(s) Summary
Image spec, registration, and test wiring
dockerfiles/Dockerfile.nemo-gym, nemo_skills/__init__.py, cluster_configs/example-local.yaml, tests/gpu-tests/test-local.yaml
Adds dockerfiles/Dockerfile.nemo-gym that pins NeMo-Gym source, installs OS packages and uv, creates a Python 3.12 virtualenv, pre-syncs dependencies, and runs import/CLI sanity checks. Registers the new nemo-gym container in _containers, the example local cluster config, and the GPU test local config.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately captures the main change: adding a new minimal Dockerfile for NeMo-Gym. It is specific, concise, and clearly describes the primary purpose of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch georgea/add-nemo-gym-dockerfile

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@dockerfiles/Dockerfile.nemo-gym`:
- Around line 56-79: The final image stage runs as root; create a non-root user
and switch to it before finishing the "gym" stage: add a dedicated user/group
(e.g., nemo or nemo_gym_user) and a home directory, chown the app dir
(/opt/NeMo-Gym) and the baked venv (.venv) to that user, and set USER to that
account (and optionally set HOME and PATH) so subsequent containers run
non-root; update any RUNs that rely on root-only paths to use the new user
ownership (refer to the "gym" stage, the .venv, NEMO_GYM_PATH, and the uv/venv
setup commands when adjusting ownership).
- Line 53: The Dockerfile currently pipes the remote installer directly into sh
using the RUN curl ... | sh pattern for the UV installer (UV_VERSION, installer
URL https://astral.sh/uv/${UV_VERSION}/install.sh and target dir
/usr/local/bin); change this to first download the installer and its published
checksum (or a signed artifact) into the image, verify the checksum/signature
against a trusted value, and only then execute the installer; implement this by
replacing the pipe with a sequence that curl -fSLo the install.sh and checksum
file, validate the checksum for install.sh, and then run install.sh with
UV_INSTALL_DIR=/usr/local/bin, failing the build if verification fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a9086948-caad-4f88-b08c-b28a6aa8e771

📥 Commits

Reviewing files that changed from the base of the PR and between 661356d and 0d2a4ef.

📒 Files selected for processing (2)
  • .github/workflows/dockerfile_nemo_gym.yml
  • dockerfiles/Dockerfile.nemo-gym

# Install uv into /usr/local/bin so it's on the default PATH even when SLURM/pyxis
# strips the image's ENV PATH (pyxis resets PATH to the host's default and the
# image's ENV PATH is dropped, which can make `uv` unfindable inside the job).
RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

# Find and examine the Dockerfile
find . -name "Dockerfile.nemo-gym" -type f 2>/dev/null

Repository: NVIDIA-NeMo/Skills

Length of output: 96


🏁 Script executed:

# Check file size and examine the relevant section
if [ -f "dockerfiles/Dockerfile.nemo-gym" ]; then
  wc -l "dockerfiles/Dockerfile.nemo-gym"
  echo "=== Lines 45-60 ==="
  sed -n '45,60p' "dockerfiles/Dockerfile.nemo-gym"
  echo "=== Full file ==="
  cat -n "dockerfiles/Dockerfile.nemo-gym"
fi

Repository: NVIDIA-NeMo/Skills

Length of output: 4308


🏁 Script executed:

# Search for USER directive in the Dockerfile
if [ -f "dockerfiles/Dockerfile.nemo-gym" ]; then
  grep -n "USER" "dockerfiles/Dockerfile.nemo-gym" || echo "No USER directive found"
fi

Repository: NVIDIA-NeMo/Skills

Length of output: 86


🌐 Web query:

uv installer checksum verification astral.sh

💡 Result:

Answer (2026-05-12): For uv’s standalone shell installer, checksum verification is done in the generated installer script itself (it verifies the downloaded uv tarball against embedded sha256 values). Historically there was a period where the installer printed “no checksums to verify”, but issue/PR activity indicates this was addressed for the.sh installers (with Windows PowerShell still noted as missing at the time). [1][2] What “uv installer checksum verification” means in practice 1) The default install path the docs promote is running the installer script from https://astral.sh/uv/install.sh via curl|sh. [3] 2) In older installer behavior, the script could download uv but not verify checksums (“no checksums to verify”). That was reported as a security-gap; the investigation noted the installer script logic existed but lacked checksum values. [1] 3) Later, uv’s project indicates the.sh installers embed and check tarball checksums starting with version 0.11.0; Windows (.ps1) was still missing in that timeframe. [1] 4) There is also related work explicitly targeting “Enable checksum verification in the generated installer script” by embedding checksums into the installer scripts. [2] Current/implementation details you can use to validate manually - The installer is a script; for the.sh installer it includes checksum values and should output/perform verification when downloading the tarball (the earlier example output shows downloading a matching.sha256 and then “verifying checksum sha256 … for … input.tar.gz”). [1] If you want to do defense-in-depth yourself, you can: - Inspect the installer before executing (the docs mention you can pipe to less, which is useful to confirm checksum-related code/embedded values are present). [3] - Prefer a pinned version URL (the docs show version-specific install.sh URLs). [3]

Citations:


🌐 Web query:

uv package manager installation security signature verification

💡 Result:

The uv package manager (from Astral) installation via the recommended standalone installer (curl -LsSf https://astral.sh/uv/install.sh | sh) downloads a prebuilt binary tarball and verifies its checksum. Since uv version 0.11.0, the.sh installers embed and automatically check the tarball's checksums before installation [1][2]. The Windows.ps1 installer was still missing this at the time of the discussion, but recent releases provide GitHub Artifact Attestations for downloaded binaries, verifiable via gh attestation verify [3]. Official docs suggest inspecting the script before piping to sh for added caution [4][5]. For Python packages installed using uv (e.g., uv pip install, uv add), uv follows standard Python packaging security: it verifies wheel file hashes from the lockfile (uv.lock) against downloads from PyPI or configured indexes, preventing tampering [6]. There is no additional cryptographic signature verification on PyPI packages themselves, as PyPI does not provide signed packages—security relies on HTTPS transport, hash verification from metadata, and lockfiles [7]. uv supports PEP 700 upload-time for exclude-newer to block recently published (potentially malicious) packages [7][8]. uv also has a preview uv audit command to scan locked dependencies for known vulnerabilities from the Python Packaging Advisory Database [9]. For publishing packages with uv publish, it supports uploading attestations (e.g., SLSA Provenance) if present, but does not generate them [10]. No cryptographic signatures on the uv tool binary itself beyond checksums and attestations.

Citations:


Avoid piping a remote installer script straight to sh.

This is a supply-chain gap: the build executes network content without an integrity check. The uv installer for version 0.9.30 does not include built-in checksum verification. Download, verify checksum, then execute.

Suggested hardening
 ARG UV_VERSION=0.9.30  # Gym's pyproject.toml sets [tool.uv] required-version = ">=0.9.30"
+ARG UV_INSTALLER_SHA256=<publish-and-pin-this>
 # Install uv into /usr/local/bin so it's on the default PATH even when SLURM/pyxis
 # strips the image's ENV PATH (pyxis resets PATH to the host's default and the
 # image's ENV PATH is dropped, which can make `uv` unfindable inside the job).
-RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh
+RUN curl -fLsS "https://astral.sh/uv/${UV_VERSION}/install.sh" -o /tmp/uv-install.sh \
+    && echo "${UV_INSTALLER_SHA256}  /tmp/uv-install.sh" | sha256sum -c - \
+    && env UV_INSTALL_DIR=/usr/local/bin sh /tmp/uv-install.sh \
+    && rm -f /tmp/uv-install.sh
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh
ARG UV_VERSION=0.9.30 # Gym's pyproject.toml sets [tool.uv] required-version = ">=0.9.30"
ARG UV_INSTALLER_SHA256=<publish-and-pin-this>
# Install uv into /usr/local/bin so it's on the default PATH even when SLURM/pyxis
# strips the image's ENV PATH (pyxis resets PATH to the host's default and the
# image's ENV PATH is dropped, which can make `uv` unfindable inside the job).
RUN curl -fLsS "https://astral.sh/uv/${UV_VERSION}/install.sh" -o /tmp/uv-install.sh \
&& echo "${UV_INSTALLER_SHA256} /tmp/uv-install.sh" | sha256sum -c - \
&& env UV_INSTALL_DIR=/usr/local/bin sh /tmp/uv-install.sh \
&& rm -f /tmp/uv-install.sh
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dockerfiles/Dockerfile.nemo-gym` at line 53, The Dockerfile currently pipes
the remote installer directly into sh using the RUN curl ... | sh pattern for
the UV installer (UV_VERSION, installer URL
https://astral.sh/uv/${UV_VERSION}/install.sh and target dir /usr/local/bin);
change this to first download the installer and its published checksum (or a
signed artifact) into the image, verify the checksum/signature against a trusted
value, and only then execute the installer; implement this by replacing the pipe
with a sequence that curl -fSLo the install.sh and checksum file, validate the
checksum for install.sh, and then run install.sh with
UV_INSTALL_DIR=/usr/local/bin, failing the build if verification fails.

Comment thread dockerfiles/Dockerfile.nemo-gym Outdated
Comment on lines +56 to +79
FROM base AS gym

WORKDIR /opt/NeMo-Gym
COPY --from=gym-src / /opt/NeMo-Gym/

# Pre-create the venv + warm the uv cache. `nemo_gym_rollouts` runs
# `uv venv --python 3.12 --allow-existing .venv` + `uv sync --active --extra dev`
# at job start; with the cache warm this completes in ~1s.
#
# --copies places a full python binary inside .venv/bin so the venv doesn't
# depend on any uv-managed interpreter path that could vanish during image
# flattening (otherwise the symlink target under /root/.local/share/uv/python/
# can be missing in the final squashfs).
ENV UV_LINK_MODE=copy
RUN uv venv --python /usr/local/bin/python3.12 .venv \
&& uv sync --active --extra dev

# Sanity: verify the baked venv imports Gym's core modules and exposes ng_run.
RUN . .venv/bin/activate \
&& python -c "import nemo_gym, nemo_gym.cli; print('nemo_gym', nemo_gym.__version__)" \
&& command -v ng_run \
&& command -v ng_collect_rollouts

ENV NEMO_GYM_PATH=/opt/NeMo-Gym

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Run the final image as a non-root user.

The container currently runs as root. Add a dedicated user and switch to it in the final stage.

Suggested hardening
 FROM base AS gym
@@
 RUN . .venv/bin/activate \
     && python -c "import nemo_gym, nemo_gym.cli; print('nemo_gym', nemo_gym.__version__)" \
     && command -v ng_run \
     && command -v ng_collect_rollouts
 
 ENV NEMO_GYM_PATH=/opt/NeMo-Gym
+RUN useradd --system --create-home --home-dir /home/nemo nemo \
+    && chown -R nemo:nemo /opt/NeMo-Gym
+USER nemo
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dockerfiles/Dockerfile.nemo-gym` around lines 56 - 79, The final image stage
runs as root; create a non-root user and switch to it before finishing the "gym"
stage: add a dedicated user/group (e.g., nemo or nemo_gym_user) and a home
directory, chown the app dir (/opt/NeMo-Gym) and the baked venv (.venv) to that
user, and set USER to that account (and optionally set HOME and PATH) so
subsequent containers run non-root; update any RUNs that rely on root-only paths
to use the new user ownership (refer to the "gym" stage, the .venv,
NEMO_GYM_PATH, and the uv/venv setup commands when adjusting ownership).

Comment thread dockerfiles/Dockerfile.nemo-gym Resolved
So nemo_gym_rollouts picks up the new Dockerfile.nemo-gym image via
cluster_config['containers']['nemo-gym'] without callers needing to
pass --gym_container explicitly.

Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
- nemo_skills/__init__.py: add nemo-gym to _containers so `ns setup`
  initializes the entry by default.
- tests/gpu-tests/test-local.yaml: mirror the addition so GPU test
  configs are aligned with the example config.

Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
@gwarmstrong
gwarmstrong enabled auto-merge (squash) May 13, 2026 00:01
Comment thread dockerfiles/Dockerfile.nemo-gym Outdated
&& command -v ng_run \
&& command -v ng_collect_rollouts

ENV NEMO_GYM_PATH=/opt/NeMo-Gym

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just /opt/Gym then? To match default repo name

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 14eb530

@gwarmstrong
gwarmstrong disabled auto-merge May 13, 2026 00:04
Match the default checkout directory name from
`git clone https://github.com/NVIDIA-NeMo/Gym.git` (which produces
`Gym/`), per review feedback. Updates WORKDIR, COPY target, header
comment, and NEMO_GYM_PATH env var.

Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
dockerfiles/Dockerfile.nemo-gym (2)

56-80: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Run final image as non-root user.

The final gym stage has no USER, so runtime defaults to root. Add a dedicated user and chown /opt/Gym (including .venv) before switching.

Suggested hardening diff
 FROM base AS gym
@@
 RUN . .venv/bin/activate \
     && python -c "import nemo_gym, nemo_gym.cli; print('nemo_gym', nemo_gym.__version__)" \
     && command -v ng_run \
     && command -v ng_collect_rollouts
 
 ENV NEMO_GYM_PATH=/opt/Gym
+RUN useradd --system --create-home --home-dir /home/nemo nemo \
+    && chown -R nemo:nemo /opt/Gym
+USER nemo
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dockerfiles/Dockerfile.nemo-gym` around lines 56 - 80, The final gym image
currently runs as root; create a non-root user and switch to it in the gym stage
by adding a dedicated user (e.g., nemo or nemo_gym), chown /opt/Gym (including
.venv) to that user after the uv venv/uv sync steps, and set USER to that
account before the stage ends; reference the gym stage, the /opt/Gym directory
(and its .venv), the uv venv/uv sync steps where ownership should be fixed, and
the NEMO_GYM_PATH environment var so the runtime process
(ng_run/ng_collect_rollouts) runs as the new non-root user.

53-53: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Harden uv install by avoiding curl | sh on Line 53.

This still executes remote script content directly at build time. Download, verify checksum/signature, then execute.

#!/bin/bash
# Verify whether the Dockerfile still uses direct pipe-to-shell for uv installer
rg -n 'astral\.sh/uv/.*/install\.sh\s*\|\s*env\s+UV_INSTALL_DIR=.*/usr/local/bin\s+sh' dockerfiles/Dockerfile.nemo-gym
Suggested hardening diff
 ARG UV_VERSION=0.9.30  # Gym's pyproject.toml sets [tool.uv] required-version = ">=0.9.30"
+ARG UV_INSTALLER_SHA256=<pin-installer-sha256>
 # Install uv into /usr/local/bin so it's on the default PATH even when SLURM/pyxis
 # strips the image's ENV PATH (pyxis resets PATH to the host's default and the
 # image's ENV PATH is dropped, which can make `uv` unfindable inside the job).
-RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh
+RUN curl -fLsS "https://astral.sh/uv/${UV_VERSION}/install.sh" -o /tmp/uv-install.sh \
+    && echo "${UV_INSTALLER_SHA256}  /tmp/uv-install.sh" | sha256sum -c - \
+    && env UV_INSTALL_DIR=/usr/local/bin sh /tmp/uv-install.sh \
+    && rm -f /tmp/uv-install.sh
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dockerfiles/Dockerfile.nemo-gym` at line 53, Replace the unsafe "curl | sh"
RUN step that installs uv (the line using UV_VERSION and
astral.sh/uv/.../install.sh) by first downloading the installer to a temporary
file with curl, verify its integrity (checksum or signature) against a
known-good value or key, only then execute it with UV_INSTALL_DIR=/usr/local/bin
sh, and finally remove the temporary installer; update the Dockerfile to
reference UV_VERSION and add ENV/ARG or build-arg for the expected
checksum/signature so the verification step can fail the build if validation
does not match.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@dockerfiles/Dockerfile.nemo-gym`:
- Around line 56-80: The final gym image currently runs as root; create a
non-root user and switch to it in the gym stage by adding a dedicated user
(e.g., nemo or nemo_gym), chown /opt/Gym (including .venv) to that user after
the uv venv/uv sync steps, and set USER to that account before the stage ends;
reference the gym stage, the /opt/Gym directory (and its .venv), the uv venv/uv
sync steps where ownership should be fixed, and the NEMO_GYM_PATH environment
var so the runtime process (ng_run/ng_collect_rollouts) runs as the new non-root
user.
- Line 53: Replace the unsafe "curl | sh" RUN step that installs uv (the line
using UV_VERSION and astral.sh/uv/.../install.sh) by first downloading the
installer to a temporary file with curl, verify its integrity (checksum or
signature) against a known-good value or key, only then execute it with
UV_INSTALL_DIR=/usr/local/bin sh, and finally remove the temporary installer;
update the Dockerfile to reference UV_VERSION and add ENV/ARG or build-arg for
the expected checksum/signature so the verification step can fail the build if
validation does not match.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8f43ccd4-4c47-4508-aa54-023616fae06b

📥 Commits

Reviewing files that changed from the base of the PR and between 8a815f9 and 14eb530.

📒 Files selected for processing (1)
  • dockerfiles/Dockerfile.nemo-gym

@gwarmstrong
gwarmstrong enabled auto-merge (squash) May 13, 2026 00:09
@gwarmstrong
gwarmstrong merged commit fc80018 into main May 13, 2026
5 checks passed
@gwarmstrong
gwarmstrong deleted the georgea/add-nemo-gym-dockerfile branch May 13, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants