yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

yarn wr #5401

Open dagda1 opened 6 years ago

dagda1 commented 6 years ago

I am using yarn workspaces and I have this packages in my package.json:

  "workspaces": ["packages/*"]

I am trying to create a docker image to deploy and I have the following Dockerfile:

    # 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 there is no source code in the docker image so it is trying to install it from yarnpkg.

what is the best way to handle workspaces when deploying to a docker image.

rally25rs commented 6 years ago

Could you copy the entire workspace instead of just 1 package?

dagda1 commented 6 years ago

@rally25rs by the entire workspace do you mean, the whole node shebang so if I have:

root
 |_node_modules
        -----|_ package_1
        -----|_package_2
        -----|_package_3
        -----|_deploy_pkg

So then I want the thing I want to deploy deploy_pkg which has dependencies on package_1, package_2 and package_3 then I need to deploy the whole root?

The symlinking is making this very difficult.

Is there another option?

dagda1 commented 6 years ago

Is it possible to create a bundle that I can just copy into the docker image or do I have to pass in everything?