You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am struggling a little to get my head around an appropriate workflow for Yarn 3 in official Node docker images (using': node:16.13.2-alpine3.15).
It seems when I add the NODE_ENV=production environment flag to the Dockerfile, and do a build it is ignored and it installs all the development packages. This is the case both with nodeLinker: node-modules and without. Is this expected?
Here is a process to test. When I use this process with yarn v1 without running yarn set version stable it only installs dependencies, not development dependencies but the below always installs both.
docker run -it node:16.13.2-alpine3.15 sh
yarn set version stable
yarn --version
3.2.0
mkdir test
cd test
apk add git
yarn init
yarn add -D typescript
yarn add axios
NODE_ENV=production yarn install
ls .yarn/cache
axios-npm-0.26.1-a6641ce4e3-d9eb58ff4b.zip
typescript-npm-4.6.3-1493ebc82b-255bb26c8c.zip
follow-redirects-npm-1.14.9-522f191631-f5982e0eb4.zip
typescript-patch-30b732d1e2-6bf45caf84.zip
echo 'nodeLinker: node-modules' >> .yarnrc.yml
NODE_ENV=production yarn install
ls ./node_modules
axios
follow-redirects
typescript
A separate question. I am building for multi-arch images, and wondering what implications this may have for 'Zero Install'. Will a Yarn install on my local system (Mac M1) have implications for any node installs that may be architecture specific? Should we always do the Yarn install to generate the cache on an architecture equivalent to the one we are deploying to as a rule of thumb? Maybe I missed something, but couldn't see anything documented on it.
There are some example docker builds here, but wow, it's really convoluted to get yarn and docker to work like this. Has anyone come across a better way?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am struggling a little to get my head around an appropriate workflow for Yarn 3 in official Node docker images (using':
node:16.13.2-alpine3.15
).It seems when I add the
NODE_ENV=production
environment flag to the Dockerfile, and do a build it is ignored and it installs all the development packages. This is the case both withnodeLinker: node-modules
and without. Is this expected?Here is a process to test. When I use this process with yarn v1 without running
yarn set version stable
it only installs dependencies, not development dependencies but the below always installs both.A separate question. I am building for multi-arch images, and wondering what implications this may have for 'Zero Install'. Will a Yarn install on my local system (Mac M1) have implications for any node installs that may be architecture specific? Should we always do the Yarn install to generate the cache on an architecture equivalent to the one we are deploying to as a rule of thumb? Maybe I missed something, but couldn't see anything documented on it.
There are some example docker builds here, but wow, it's really convoluted to get yarn and docker to work like this. Has anyone come across a better way?
Beta Was this translation helpful? Give feedback.
All reactions