1+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+ // README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
3+ {
4+ "name" : " Node.js & TypeScript" ,
5+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+ "image" : " mcr.microsoft.com/devcontainers/typescript-node:4-24-bookworm" ,
7+ "features" : {
8+ "ghcr.io/itsmechlark/features/1password:1.5.0" : {}
9+ },
10+ "runArgs" : [
11+ " -e" ,
12+ " OP_CONNECT_HOST=http://host.docker.internal:8082" ,
13+ " --env-file" ,
14+ " ${localWorkspaceFolder}/.env.development"
15+ ],
16+ // required if you're using zscaler
17+ "containerEnv" : {
18+ "NODE_EXTRA_CA_CERTS" : " /home/node/zscaler-root-ca.pem"
19+ },
20+ "mounts" : [
21+ " source=${localEnv:HOME}/Documents/zscaler-root-ca.pem,target=/home/node/zscaler-root-ca.pem,type=bind,consistency=cached"
22+ ],
23+ // the initialize command should use the 1password cli "op read <vault-url-refercen" to populate the OP_CONNECT_HOST and OP_CONNECT_TOKEN as environment variables
24+ "initializeCommand" : " git config --global http.sslCAInfo \" /home/node/zscaler-root-ca.pem\" && rm -f \" ./.env.development\" ; echo \" OP_CONNECT_TOKEN=\" $(op --account UKGDHLSTCVF5BFAGAXUAVVS3HM read 'op://LocalDev/1Password Connect Server Token/password')\"\" >> ${localWorkspaceFolder}/.env.development" ,
25+ // Once the container is created, the env is already set so we can remove the .env.development file that contains the token on-disk
26+ "postStartCommand" : " if [ -n './.env.development' ]; then rm -f './.env.development'; fi;" ,
27+ "postCreateCommand" : " if [ -n './.env.development' ]; then rm -f './.env.development'; fi;"
28+ // Features to add to the dev container. More info: https://containers.dev/features.
29+ // "features": {},
30+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
31+ // "forwardPorts": [8080, 8082]
32+ // Use 'postCreateCommand' to run commands after the container is created.
33+ // "postCreateCommand": "yarn install",
34+ // Configure tool-specific properties.
35+ // "customizations": {},
36+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
37+ // "remoteUser": "root"
38+ }
0 commit comments