Dealing with Docker images in a Javascript/Typescript monorepo with unpublished packages
For people who hit a similar issue in their development, I wanted to provide the solution I ended up with.
First, I setup a package.json in the root of my mono-repository using yarn workspaces:
{ "name": "ticketing", "private": true, "workspaces": [ "common", "service-one", "service-two" ]}
Then, for each service's docker file, I would copy over the common projects:
FROM node:alpine as builderWORKDIR /appCOPY package.json .COPY common ./commonCOPY service-one./service-oneFROM builder as prodWORKDIR /appENV NODE_ENV=productionRUN npm install --prodCMD npm run prod -w @project/service-oneFROM builder as devWORKDIR /appENV CI=trueRUN npm installCMD npm run dev -w @project/service-one
With this setup, I didn't need to npm publish my commons anymore.