Yarn set inside a docker image with yarn workspaces

I use yarn work areas and I have these packages in my package. json:

"workspaces": ["packages/*"] 

I am trying to create a docker image for deployment and I have the following Docker file:

 # production dockerfile FROM node:9.2 # add code COPY ./packages/website/dist /cutting WORKDIR /cutting COPY package.json /cutting/ RUN yarn install --pure-lockfile && yarn cache clean --production CMD npm run serve 

But I get the following error:

Error An unexpected error occurred: " https://registry.yarnpkg.com/@cutting%2futil : Not Found"

@cutting/util is the name of one of my workspace packages.

So the problem is that the source code in the docker image is missing, so he is trying to install it from yarnpkg.

What is the best way to handle workspaces when deploying dockers to an image.

+5
source share

Source: https://habr.com/ru/post/1275565/


All Articles