Skip to content

feat(docker): expose UV_INDEX_URL and NPM_REGISTRY as optional build args#258

Open
alvinkam2001 wants to merge 2 commits into
mainfrom
akam/configurable-pkg-index-urls
Open

feat(docker): expose UV_INDEX_URL and NPM_REGISTRY as optional build args#258
alvinkam2001 wants to merge 2 commits into
mainfrom
akam/configurable-pkg-index-urls

Conversation

@alvinkam2001
Copy link
Copy Markdown
Contributor

@alvinkam2001 alvinkam2001 commented Jun 1, 2026

Adds optional Docker build args so images can be built behind networks that block public PyPI / npm and instead mirror the registries via internal proxy (this is the case for Rocket).

Usage:

docker build \
  --build-arg UV_INDEX_URL=https://artifactory.example.com/api/pypi/pypi-remote/simple/ \
  -f agentex/Dockerfile .

docker build \
  --build-arg NPM_REGISTRY=https://artifactory.example.com/api/npm/npm-remote/ \
  -f agentex-ui/Dockerfile .

By default falls back to current behaviour if args are not specified

Greptile Summary

This PR exposes optional UV_INDEX_URL / UV_EXTRA_INDEX_URL and NPM_REGISTRY as Docker build args so images can be built behind networks that block public PyPI / npm registries. Both Dockerfiles fall back to standard public-registry behaviour when the args are omitted.

  • agentex/Dockerfile: Adds ARG-only declarations (no ENV) for the two uv index vars and wraps each uv sync call with a shell conditional (if [ -n "..." ]; then export ...) so uv never sees an empty-string env var. Args are correctly redeclared in every stage that needs them (base, dev, docs-builder); the production stage copies built artefacts from base and requires no changes.
  • agentex-ui/Dockerfile: Adds ARG NPM_REGISTRY=https://registry.npmjs.org/ with a non-empty default and passes it directly to npm config set registry inside the builder stage, keeping the URL out of the final production image's environment.

Confidence Score: 5/5

Safe to merge — both Dockerfiles preserve existing default behaviour and the internal proxy URLs are not written into final image ENV layers.

The changes are additive-only build-time args with safe empty/default values. The uv conditional-export pattern prevents the empty-string env var pitfall previously flagged. Each downstream stage correctly redeclares the ARGs, and neither production image carries the proxy URL in its environment metadata.

No files require special attention.

Important Files Changed

Filename Overview
agentex/Dockerfile Adds optional ARG-only UV_INDEX_URL / UV_EXTRA_INDEX_URL with shell-guarded conditional exports in each stage's RUN; correctly redeclared in dev and docs-builder stages; production stage unaffected.
agentex-ui/Dockerfile Adds ARG NPM_REGISTRY with a valid public-registry default; used only in the builder stage's npm config set command, not exposed as ENV in the final production image.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["docker build --build-arg UV_INDEX_URL=... / NPM_REGISTRY=..."]

    subgraph agentex/Dockerfile
        B["base stage\nARG UV_INDEX_URL=\nARG UV_EXTRA_INDEX_URL="]
        C{"UV_INDEX_URL non-empty?"}
        D["export UV_INDEX_URL\nuv sync --frozen --no-dev"]
        E["uv sync --frozen --no-dev\n(default PyPI)"]
        F["dev stage\nredeclares ARGs\nuv sync --group dev"]
        G["docs-builder stage\nredeclares ARGs\nuv sync --group docs"]
        H["production stage\nCOPY --from=base\n(no uv sync needed)"]
    end

    subgraph agentex-ui/Dockerfile
        I["builder stage\nARG NPM_REGISTRY=https://registry.npmjs.org/"]
        J["npm config set registry NPM_REGISTRY\nnpm ci"]
        K["production stage\nCOPY built artifacts\n(no npm install)"]
    end

    A --> B
    B --> C
    C -->|yes| D
    C -->|no| E
    D --> F
    E --> F
    F --> G
    G --> H

    A --> I
    I --> J
    J --> K
Loading

Reviews (2): Last reviewed commit: "empty arg safety adjustments" | Re-trigger Greptile

@alvinkam2001 alvinkam2001 requested a review from a team as a code owner June 1, 2026 16:19
Comment thread agentex/Dockerfile Outdated
Comment thread agentex/Dockerfile Outdated
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