Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions deps_rocker/extensions/codex/codex_snippet.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Install OpenAI Codex CLI with BuildKit cache for npm global installs
RUN --mount=type=cache,target=/root/.npm,id=global-npm-cache \
npm install -g @@openai/codex
5 changes: 0 additions & 5 deletions deps_rocker/extensions/codex/codex_user_snippet.Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion deps_rocker/extensions/codex/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -l
#!/bin/bash
set -e

echo "Testing codex installation..."
Expand Down
3 changes: 3 additions & 0 deletions deps_rocker/extensions/gemini/gemini_snippet.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Install Google Gemini CLI tool via npm with BuildKit cache for global installs
RUN --mount=type=cache,target=/root/.npm,id=global-npm-cache \
npm install -g @@google/gemini-cli

This file was deleted.

2 changes: 1 addition & 1 deletion deps_rocker/extensions/gemini/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -l
#!/bin/bash
set -e

echo "Testing gemini installation..."
Expand Down
10 changes: 8 additions & 2 deletions deps_rocker/extensions/npm/npm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@


class Npm(SimpleRockerExtension):
"""Install npm via pixi using nodejs from conda-forge"""
"""Install npm using nvm (Node Version Manager)"""

name = "npm"
depends_on_extension = ("pixi",)
depends_on_extension = ("curl",)
builder_apt_packages = ["curl", "ca-certificates", "git"]

empy_args = {
"NODE_VERSION": "24.9.0",
"NPM_VERSION": "11.6.1",
}
32 changes: 32 additions & 0 deletions deps_rocker/extensions/npm/npm_builder_snippet.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# syntax=docker/dockerfile:1.4
ARG NODE_VERSION=@NODE_VERSION@

@(f"FROM {base_image} AS {builder_stage}")

ARG NODE_VERSION
ENV NVM_DIR=/usr/local/nvm

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache \
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked,id=apt-lists \
apt-get update && \
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*

# Clone nvm from git with caching
RUN --mount=type=cache,target=/tmp/nvm-git-cache,id=nvm-git-cache \
bash -c "set -e && \
if [ -d /tmp/nvm-git-cache/.git ]; then \
cd /tmp/nvm-git-cache && git fetch --tags && git checkout v0.40.3; \
else \
git clone https://github.com/nvm-sh/nvm.git /tmp/nvm-git-cache && \
Comment on lines +18 to +21
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): Align the nvm tag between the cache-hit and fresh-clone paths.

Using v0.40.3 in the cache-hit path and v0.40.0 in the fresh-clone path means builds can produce different environments depending on cache state. Please use the same tag in both branches, ideally defined once (e.g., as a build arg or variable) to prevent future drift.

cd /tmp/nvm-git-cache && git checkout v0.40.0; \
fi && \
# Use tar to copy nvm cache, excluding .git, test, and .github for smaller image and security
# Ensure /usr/local/nvm exists before extracting
mkdir -p /usr/local/nvm && tar --exclude='.git' --exclude='test' --exclude='.github' -cf - -C /tmp/nvm-git-cache . | tar -xf - -C /usr/local/nvm"

# Install Node.js using nvm with cached downloads - use template substitution for version
RUN --mount=type=cache,target=/usr/local/nvm/.cache,id=nvm-node-cache \
bash -c "set -e && \
. \$NVM_DIR/nvm.sh && \
nvm install @(NODE_VERSION)"
13 changes: 13 additions & 0 deletions deps_rocker/extensions/npm/npm_snippet.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

ENV NODE_VERSION=24.9.0
# Install nvm, node and npm
ENV NVM_DIR=/usr/local/nvm
Comment on lines +2 to +4
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (bug_risk): Avoid hardcoding NODE_VERSION in the runtime snippet to prevent drift from the builder configuration.

The builder uses ARG NODE_VERSION=@NODE_VERSION@ with NODE_VERSION defined in empy_args, but this runtime snippet hardcodes ENV NODE_VERSION=24.9.0. If the version is updated in empy_args but not here, PATH will reference the wrong Node version. Please derive this ENV from the same NODE_VERSION value (e.g., via empy substitution) so there’s a single source of truth.

Suggested change
ENV NODE_VERSION=24.9.0
# Install nvm, node and npm
ENV NVM_DIR=/usr/local/nvm
ENV NODE_VERSION=@NODE_VERSION@
# Install nvm, node and npm
ENV NVM_DIR=/usr/local/nvm


ENV NPM_CONFIG_UPDATE_NOTIFIER=false
ENV NPM_CONFIG_FUND=false

# Copy pre-installed nvm directory from builder
@(f"COPY --from={builder_stage} $NVM_DIR $NVM_DIR")

# Add node and npm to path
ENV PATH="$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH"
17 changes: 0 additions & 17 deletions deps_rocker/extensions/npm/npm_user_snippet.Dockerfile

This file was deleted.

3 changes: 2 additions & 1 deletion deps_rocker/extensions/npm/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash -l
#!/bin/bash

set -e

echo "Testing npm installation..."
Expand Down
29 changes: 0 additions & 29 deletions specs/01/npm-pixi-install/plan.md

This file was deleted.

23 changes: 0 additions & 23 deletions specs/01/npm-pixi-install/spec.md

This file was deleted.