How to Dockerize NestJS with MySQL

Поділитися
Вставка
  • Опубліковано 8 вер 2024
  • Support the Channel:
    Become a Member: www.youtube.co...
    Become a Patreon: / stuyy
    Buy me a Coffee: ko-fi.com/anson
    Donate on Streamlabs: streamlabs.com...
    Donate on PayPal: paypal.me/anso...
    Connect with me:
    Twitter: / ansonthedev
    Discord: / discord
    GitHub: github.com/stuyy
    Twitch: / stuy

КОМЕНТАРІ • 33

  • @brunobragaw8t
    @brunobragaw8t 5 місяців тому +1

    The explanation on mounting the /src finally made it clear for me on how to develop locally with Docker. Thanks a lot.

  • @jagadeeps3095
    @jagadeeps3095 7 місяців тому +2

    the best dockerize video i have ever seen. Thank you so much Anson for this straight forward and clean explanation👍👍

  • @edwinchan8190
    @edwinchan8190 2 місяці тому +1

    Very clear and concise video on dockerizing nestjs app, thanks so much!

  • @amritniure465
    @amritniure465 Місяць тому +1

    If anyone is facing the trouble " Error: Cannot find module '/usr/src/app/dist/main " . You can change the start:prod script in package.json to: "start:prod": "node dist/src/main",
    it is because the main file inside the container is inside the /usr/src/app/dist/src/main> I don't know the reason behind this. It must be something related to the tsconfig file. If you go check the files under the container the main file is in /usr/src/app/dist/src/main so, that works. Basically you need to provide the path of the main.js file of your container in your package.json file.
    If you try to build the application without docker ( in terminal ) after changing the path it won't work again because in dev environment the main file is inside the dist/ folder so hope you got the drill.

    • @bradpreston9872
      @bradpreston9872 12 днів тому

      Thank you! You saved me a good amount of debug time.

  • @Daker11Gamer
    @Daker11Gamer 5 місяців тому +1

    WOW! Super underated video this gotta have a million views this is gold!

  • @kellslte
    @kellslte 7 місяців тому +1

    I love this tutorial. So straight to the point! Thank you! 🎉

  • @_kenJ
    @_kenJ Місяць тому

    thaks bro, a wasnt understanding to much the volume of docker and a finally undestood this part of docker. And also i finally can code with docker

  • @dileepa-mn2to
    @dileepa-mn2to 7 місяців тому +2

    Thank you brother. Love this

  • @juanmacias5922
    @juanmacias5922 7 місяців тому

    Thank you so much for another solid tutorial Anson. I was toying with the idea of looking into Docker.

  • @dr-Jonas-Birch
    @dr-Jonas-Birch 7 місяців тому +2

    Excellent video. JB

  • @ehSamurai3483
    @ehSamurai3483 3 місяці тому

    In docker compose you can add a dependency to mysql, so it will first start mysql before starting the nestjs server.

  • @Bregylais
    @Bregylais 3 місяці тому

    Beautifully explained, thank you.

  • @wisdomekpot7426
    @wisdomekpot7426 28 днів тому

    I love this tutorial.

  • @dileepa-mn2to
    @dileepa-mn2to 7 місяців тому +1

    can you create a video about e2e and unit testing in jest in nestjs covering all the aspects of testing. Thanks

    • @ansonthedev
      @ansonthedev  7 місяців тому +1

      I have. Check my NestJS playlist. ua-cam.com/play/PL_cUvD4qzbkw-phjGK2qq0nQiG6gw1cKK.html

  • @FrankYupanquiAllcca
    @FrankYupanquiAllcca 2 місяці тому

    I got an "TypeError [ERR_STREAM_NULL_VALUES]: May not write null values to stream" at "npm i" instruction. How can I fix it?

  • @Songpon-wc2ob
    @Songpon-wc2ob 3 дні тому

    thank

  • @jagajaga6908
    @jagajaga6908 5 місяців тому

    thank you bro, very nice tutorial!!!

  • @davidkhvedelidze6536
    @davidkhvedelidze6536 3 місяці тому

    greate totorial ! thanks

  • @AdnanDev-su5no
    @AdnanDev-su5no 7 місяців тому

    Hi Anson, could you show us what vscode extensions you are using for your projects ?

  • @ferrywijaya6404
    @ferrywijaya6404 7 місяців тому

    hello sir thanks for the video again
    may i request a real world example using nestjs as backend and angular as front end.
    thanks you before

  • @user-hq4im9wb8k
    @user-hq4im9wb8k 7 місяців тому

    Hi I have one question how can i check the databasemeans table and all?

  • @codewithashok10
    @codewithashok10 7 місяців тому +1

    Bro please make a video express js with typescript

  • @bonchan4404
    @bonchan4404 5 місяців тому

    hello anson . thanks for this video . im following your video but im having a problem on the hot reload on the tsconfig.json its not working . im using the latest typescript version on the dev dependencies

    • @ansonthedev
      @ansonthedev  5 місяців тому +1

      I would double check the volumes and make sure they are mounted correctly. If you're on Windows make sure the watchOptions in the tsconfig is configured correctly... Here's a Stack Overflow link that may help - stackoverflow.com/questions/74815121/why-is-hot-reloading-not-working-in-my-nestjs-docker-compose-multistage-project

    • @bonchan4404
      @bonchan4404 5 місяців тому

      @@ansonthedev thanks for this anson ! started watching all of your nest js videos because im starting to a new company and nest js is one of their stack ! . really love the way you teach to code its like watching traversy media . again thank you !

  • @kumaramresh7905
    @kumaramresh7905 6 місяців тому

    I am getting
    Error: Cannot find module '/src/nest/dist/main'
    my dockerfile
    FROM node:alpine
    WORKDIR /src/nest
    COPY package*.json .
    RUN npm install -g @nestjs/cli
    RUN npm install
    COPY . .
    EXPOSE 3000
    CMD [ "npm","run","start:dev" ]
    docker-compose.yaml
    version: '2.24.3'
    services:
    server:
    container_name: server
    build:
    context: ./nest
    dockerfile: Dockerfile
    ports:
    - "3000:3000"
    volumes:
    - ./nest/src:/src/nest/src
    can anyone help me on this ?

    • @user-pj6zt5xs4s
      @user-pj6zt5xs4s 5 місяців тому

      i got the same problem. Did you find the solution?

    • @kumaramresh7905
      @kumaramresh7905 5 місяців тому

      ​@@user-pj6zt5xs4s no !! What's the solution??

    • @gregoiremaria1078
      @gregoiremaria1078 5 місяців тому

      FROM node:alpine
      WORKDIR /src/nest
      COPY package*.json .
      RUN npm install -g @nestjs/cli
      RUN npm install
      RUN npm run build // ==> missing
      COPY . .
      EXPOSE 3000
      CMD [ "npm","run","start:dev" ]

    • @Salaralali
      @Salaralali Місяць тому

      just add src to your start:prod script in package.json, like this: "start:prod": "node dist/src/main"