Skip to content

Commit c4a1a83

Browse files
authored
Configure devcontainer Dockerfile with dynamic build args for proxy package indexes (#1321)
## Summary Adds a `.devcontainer/Dockerfile` and updates `devcontainer.json` to support dynamic build arguments, allowing the dev container base image and package index URLs (npm, pip, uv) to be overridden from the local environment. This enables building the dev container behind a corporate proxy or against internal package mirrors without editing tracked files. ## Changes - **`.devcontainer/Dockerfile`** (new): Accepts `BASE_IMAGE`, `NPM_CONFIG_REGISTRY`, `PIP_INDEX_URL`, and `UV_DEFAULT_INDEX` build args, each falling back to public defaults when unset. - **`.devcontainer/devcontainer.json`**: Switches from a static `image` reference to a `build` block that forwards the corresponding `${localEnv:*}` values into the Dockerfile build args. ## Why Contributors on networks that require proxied or mirrored package registries can now set the relevant environment variables locally and have the dev container build against them, while the defaults preserve the existing public behavior for everyone else.
1 parent ab66edd commit c4a1a83

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

.devcontainer/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ARG BASE_IMAGE=
2+
FROM ${BASE_IMAGE:-mcr.microsoft.com/devcontainers/python:3.12-bookworm}
3+
4+
ARG NPM_CONFIG_REGISTRY=
5+
ENV NPM_CONFIG_REGISTRY=${NPM_CONFIG_REGISTRY:-https://registry.npmjs.org/}
6+
7+
ARG PIP_INDEX_URL=
8+
ENV PIP_INDEX_URL=${PIP_INDEX_URL:-https://pypi.org/simple/}
9+
10+
ARG UV_DEFAULT_INDEX=
11+
ENV UV_DEFAULT_INDEX=${UV_DEFAULT_INDEX:-https://pypi.org/simple/}

.devcontainer/devcontainer.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
{
44
"name": "physical-ai-toolchain-devcontainer",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/python:3.12-bookworm",
6+
"build": {
7+
"dockerfile": "Dockerfile",
8+
"args": {
9+
"BASE_IMAGE": "${localEnv:PHYSICAL_AI_DEVCONTAINER_IMAGE}",
10+
"NPM_CONFIG_REGISTRY": "${localEnv:NPM_CONFIG_REGISTRY}",
11+
"PIP_INDEX_URL": "${localEnv:PIP_INDEX_URL}",
12+
"UV_DEFAULT_INDEX": "${localEnv:UV_DEFAULT_INDEX}"
13+
}
14+
},
715
// Features to add to the dev container. More info: https://containers.dev/features.
816
"features": {
917
"ghcr.io/devcontainers/features/common-utils:2": {},

0 commit comments

Comments
 (0)