feat: make use of Nix files to set up dev env#22
Conversation
|
Kicked off a build to see if the image built from this branch works https://github.com/joyeecheung/devcontainer/actions/runs/20376852332 (when it's done it'll be published to https://hub.docker.com/r/joyeecheung/node-devcontainer) |
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
joyeecheung
left a comment
There was a problem hiding this comment.
LGTM with a suggestion on docs
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
Looks like it built successfully, not sure how to test it further though |
| # Setting up direnv for the local clone, see envrc/README.md for more info | ||
| COPY --chown=root:developer --chmod=0755 ./envrc/ /home/developer/envrc/ | ||
| ARG IMAGE_VARIANT=static-libs | ||
| RUN cp "/home/developer/envrc/${IMAGE_VARIANT}.envrc" /home/developer/nodejs/node/.envrc |
There was a problem hiding this comment.
I gave it a try and I think this now needs an update in the devcontainer.json - at least, when paired with the default published image invariant (which uses static-lib). This is because devcontainers work by mounting the working dir, which overrides the .envrc copied within the container.
"postStartCommand": "cp /home/developer/envrc/static-libs.envrc /home/developer/nodejs/node/.envrc && direnv allow /home/developer/nodejs/node"
If we add more published variant in the future, we can just add another devcontainer.json variant in the upstream that copy the corresponding envrc for a different paired image (e.g. "nodejs/devcontainer:shared-nightly" pairs with shared-libs.envrc, and then you can spin a devcontainer with a readily built shared lib configuration to test things)
Refs: nodejs/devcontainer#22 PR-URL: #61414 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im>
Refs: nodejs/devcontainer#22 PR-URL: #61414 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im>
Refs: nodejs/devcontainer#22 PR-URL: nodejs#61414 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im>
Refs: nodejs/devcontainer#22 PR-URL: #61414 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im>
I first attempted to create the Docker image using Nix tools, but that ended up being too complicated, in the end it was easier to install Nix from the Dockerfile, and update the existing scripts to use Nix provided tools.
Worth noting the image contains a
nodebuilt with all shared libs, similar to what buildstest-sharedGHA workflow on nodejs/node; we could certainly disable that to use the vendored static deps instead, the tradeoff being the build would take longer.Fixes: #18