I'm pretty new to docker, and today I've tried to dockerize our lerna monorepo using the following settings:
dockerfile
FROM node:14.13.1-alpine
# Add node modules bin to path
ENV PATH /app/node_modules/.bin:$PATH
ENV PATH /app/packages/core/node_modules/.bin:$PATH
WORKDIR /app
# Install app deps
COPY ./ ./
RUN yarn install
RUN yarn bootstrap
RUN cd packages/core && yarn install && cd ./node_modules/react && yarn link && cd ../../../../ && yarn link react
RUN cd packages/core && yarn build
CMD yarn storybook ${STORY_FILTER}
docker-compose
services:
packages:
container_name: packages
image: packages
build:
context: .
dockerfile: Dockerfile
volumes:
- '.:/app'
- '/app/node_modules'
ports:
- 6006:6006
environment:
- CHOKIDAR_USEPOLLING=true
- STORY_FILTER=packages/core/stories/forms/index
Basic file structure:
+--storybook
+--packages
| -+core
| --package.json
| -+styles
| --package.json
+--dockerfile
+--docker-compose
+--package.json
+--lerna.json
I'm currently seeing an error which states 'cannot find module react/package.json'