microsoft / vscode-dev-containers

NOTE: Most of the contents of this repository have been migrated to the new devcontainers GitHub org (https://github.com/devcontainers). See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own!
https://aka.ms/vscode-remote
MIT License
4.72k stars 1.41k forks source link

[feat] preBuildCommand #1636

Closed loynoir closed 1 year ago

loynoir commented 1 year ago

Relates to: Remote - Containers

Scenario

rebuild container

Before

  "build": {
    "dockerfile": "../Dockerfile"
  },
FROM xxx
COPY './.devcontainer/assets/' '/assets/'
RUN xxx

Every time before vscode Ctrl+Shift+p "rebuild container", need to run

$ make prepare_devcontainer_assets

After

  "preBuildCommand": "make prepare_devcontainer_assets",
  "build": {
    "dockerfile": "../Dockerfile"
  },
FROM xxx
COPY './.devcontainer/assets/' '/assets/'
RUN xxx

vscode Ctrl+Shift+p "rebuild container"

Additional

preBuildCommand is run outside container, or said run on host machine, as preBuild refer to no container state.

Maybe change name to hostPreBuildCommand, or just keep the same naming style.

loynoir commented 1 year ago

Not sure where is the exact one place to feature request.

Related https://github.com/microsoft/vscode-remote-release/issues/7228