pnpm in a Visual Studio Code devcontainer - how to deal with different container OS versions? #7649
ascheucher-shopify-partner
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After years in Python development, I am diving back into JS/TS for Shopify app development. Their starter template is a TypeScript/JavaScript app with Remix, with npm, yarn or pnpm as build tools. I chose pnpm, as I learned it has performance benefits due to more parallelism during downloads and a central store, where it hard links to, instead of copying files.
To have a repeatable development environment, I am creating a devcontainer with docker-compose with 3 container (app, PostgreSQL, MariaDB).
When I do a
pnpm i
on my host (Mac OS), then everything is installed into /Users/$USER/Library/pnpm/store/v3.For the docker devcontainers, the folder above my project folder is mounted into the docker container as /workspaces (e.g. /User/$USER/a/b/c/project, c is mounted as /workspaces) and my project folder is /workspaces/project.
When I now
pnpm i
in the project folder, the store is created in /workspaces/.pnpm-store, which is on the host /User/$USER/a/b/c/.pnpm-storeUp to here, everything is fine. But I have realised, some dependencies might need different versions of the devcontainer's OS. And different versions of devcontainer's OS lead to different versions of compiled dependencies (I know, as at least one failed to build on install in 1-18-bookwork).
My current project's Dockerfile is FROM mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye
When I migrate more Apps, I might need another Debian version. This would lead to the packages land in the same directory. Will pnpm detect this? Or will I end up in pain?
AFAIK there is no way to influence the store path. Hence, the only way to separate the .npm-stores would be to separate projects by OS and Version in different folders, which completely contradicts the whole shared store concept of pnpm.
Something like this:
If this is really an unresolved edgecase in pnpm, together with the bugs on M Series Macs, pnpm seems not a fit to be used in devcontainer development in general and on Apple Silicon in special. Or do I miss something?
Beta Was this translation helpful? Give feedback.
All reactions