I am having some problems with my mono-repository and Docker project setup.I want to use Lerna for my mono-repository setup, and Docker for project building.Before I integrated Lerna things were working just fine, but now I have Lerna integrated and I don't have any idea in what part/step I have to call lerna bootstrap because after calling this command my node_modules will be built automatically and I no more have to individually run npm install in each Dockerfile. What I do not understand is how this all will look like and will I have to create another Dockerfile for root folder? if yes then how will my docker-compose.yml file look like? It is all unclear.This is how my project tree looks like:The backend folder has basic nestjs setup and the client folder has basic Gatsby setup.```. ├── backend │ ├── Dockerfile │ ├── nest-cli.json │ ├── package.json │ ├── README.md │ ├── src │ │ ├── app.controller.spec.ts │ │ ├── app.controller.ts │ │ ├── app.module.ts │ │ ├── app.service.ts │ │ └── main.ts │ ├── test │ │ ├── app.e2e-spec.ts │ │ └── jest-e2e.json │ ├── tsconfig.build.json │ └── tsconfig.json ├── client │ ├── Dockerfile │ ├── gatsby-browser.js │ ├── gatsby-config.js │ ├── gatsby-node.js │ ├── gatsby-ssr.js │ ├── LICENSE │ ├── package.json │ ├── README.md │ └── src │ ├── components │ │ ├── header.js │ │ ├── image.js │ │ ├── layout.css │ │ ├── layout.js │ │ └── seo.js │ ├── images │ │ ├── gatsby-astronaut.png │ │ └── gatsby-icon.png │ └── pages │ ├── 404.js │ ├── index.js │ └── page-2.js ├── docker-compose.yml ├── lerna.json ├── package.json ├── README.md └── tslint.json```Dockerfile in the client folder:``` FROM node:12EXPOSE 8000 9929 9230WORKDIR /usr/src/app/clientRUN npm install -g gatsby-cliCOPY package*.json ./COPY . .RUN npm installCMD ["gatsby", "develop", "-H", "0.0.0.0" ] ```Dockerfile in the backend folder:``` FROM node:12-alpineWORKDIR /usr/src/app/backendCOPY package*.json ./RUN npm installCOPY . .EXPOSE 3000CMD [ "npm", "start" ] ```docker-compose.yml file in the root folder:``` version: "3"services: backend: image: docker-nestjs-backend build: ./backend command: npm run start:dev volumes: - ./backend:/usr/src/app/backend - /usr/src/app/backend/node_modules ports: - 3002:3000client: image: docker-gatsby-client build: ./client volumes: - ./client:/usr/src/app/client - /usr/src/app/client/node_modules ports: - "8000:8000" - "9929:9929" - "9230:9230" environment: - NODE_ENV=development - GATSBY_WEBPACK_PUBLICPATH=/ depends_on: - backend```Any help appreciated.
Submitted February 11, 2020 at 07:53PM by Musayyab-Naveed
No comments:
Post a Comment