microsoft / microsoft/vscode-remote-release
Read build args from env file i.e. private npm registry
Nobody has claimed this yet.
- Dominant language
- Dockerfile
- Stars
- 4.2k
- Forks
- 470
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
❓ It would be nice if VScode devcontainer.json supports reading build args from a file. So we won't need this workaround:
I have found a workaround to set ENV vars from a file during the docker BUILD. This is i.e. necessary if you want to use a private NPM registry during build, but you don't want to write the secrets in devcontainer.json or Dockerfile, as these files are committed to the repo.
.devcontainer/devcontainer.env ( add this file to .gitignore )
export NPM_USER=***
export NPM_PASS=***
export NPM_EMAIL=***
In the Dockerfile:
# Install npm-cli-adduser which can perform a cli npm login by reading env vars
RUN npm i -g --production --registry https://registry.npmjs.org/ npm-cli-adduser
# Set env variables from devcontainer.env. Needs to be in same RUN step as env vars will be lost in next RUN
COPY devcontainer.env devcontainer.env
RUN $(cat devcontainer.env) && npm-cli-adduser -r https://private.registry.url \
&& npm whoami
# install private registry package
RUN npm i -g -r https://private.registry.url private-registry-package
EDIT:
Another option to solve this would be to add a prebuild: property / script to devcontainer.json analog to postbuild:.
This could be even more flexible as users can copy files to the context, read envs via shell scripts and many more operations that are usually possible by calling docker build manually.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the devcontainer.json build configuration and the Dockerfile workaround described in the issue. Compare the requested env-file build args with the proposed prebuild script alternative, then test a private npm registry build without committing secrets. Done means one supported workflow is documented and verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, dockerfile
- Domain
- build-system, devops, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100