Skip to content

add --build-output-folder - #1309

Open
Patrick Stöckle (pstoeckle) wants to merge 1 commit into
devcontainers:mainfrom
pstoeckle:main
Open

Patrick Stöckle (pstoeckle) wants to merge 1 commit into
devcontainers:mainfrom
pstoeckle:main

Conversation

@pstoeckle

Copy link
Copy Markdown

Closes #1305

Co-authored-by: GitHub Copilot/GPT-5.6 Sol

Co-authored-by: GitHub Copilot/GPT-5.6 Sol
@pstoeckle

Copy link
Copy Markdown
Author

In the build output folder, one then has a build-output.json like this

{
  "dockerfile": "/path/to/cli/build-output/Dockerfile",
  "context": "/path/to/repo/.devcontainer/build",
  "target": "dev_containers_target_stage",
  "buildArgs": {
    "_DEV_CONTAINERS_BASE_IMAGE": "dev_container_auto_added_stage_label",
    "_DEV_CONTAINERS_IMAGE_USER": "root",
    "_DEV_CONTAINERS_FEATURE_CONTENT_SOURCE": "dev_container_feature_content_temp"
  },
  "buildContexts": {
    "dev_containers_feature_content_source": "/path/to/cli/build-output"
  },
  "securityOpts": [],
  "imageNames": [
    "vsc-repo-25dfb64b7b2a1cbd22862334657ed284ed34cf8dbeca3d1275ee314d790f36f1"
  ]
}

One can then use, e.g., jq and the preferred container to build the container image based on the build folder.

docker build \
	--build-context dev_containers_feature_content_source=$(jq -r '.buildContexts.dev_containers_feature_content_source' build-output.json) \
	--build-arg _DEV_CONTAINERS_BASE_IMAGE=$(jq -r '.buildArgs._DEV_CONTAINERS_BASE_IMAGE' build-output.json) \
	.

This branch has not been deployed

No deployments
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.

Feature request: devcontainer build --build-output-folder

1 participant