Compiling two apps in two folders with Docker

I am dealing with 2 package.json and from my one Docker file am trying to run a sequence of commands in each folder. I am trying to wrap my head around WORKDIR as its not behaving the way I expect.

app structure

package.json
   client/
      package.json
Dockerfile

Dockerfile

FROM ...

RUN npm install -g yarn

# run yarn install and build inside the client folder
WORKDIR ./client
RUN yarn install
RUN yarn build

# go back to the parent directory and run yarn install then CMD
WORKDIR ../
COPY . .
RUN yarn install
EXPOSE 6000
CMD ["yarn", "start"]

What is the right way to deal work with WORKDIR in this example?
I keep getting error Couldn't find a package.json file in "/client" which makes me beleive I’m not using WORKDIR correctly.

Source: StackOverflow