NestJS: Docker-Compose with Live/Hot Reloading & Debugging | Video 1/1

preview_player
Показать описание
Please make sure to read the README - to understand the concept of the series.

Timestamps:
00:00 Welcome and short Overview over the Video
00:36 Concept over the Series
01:25 Structure of this Video
01:35 Overview over the Outcome of the Video
02:50 Repetition of Concept of the Series (in Case you skipped :))
04:10 Short overview over the existing Code
06:10 Read User Story for this Video
08:05 Update/Do everything in the Dockerfile (Multi Stage Build)
17:30 Start Dockerfile and verify everything works (except the .env variables)
20:50 Update/Do docker-compose File for Hot Reload
32:50 Check that all Endpoints work with Postman
34:20 Change dokcer-compose for Debugging NestJS
37:30 Verify that Debugging works (Start docker-compose & debugger)
38:33 Verify that breakpoints work with Postman
41:50 Close User Story
42:10 Update Readme File and Commit Changes

I appreciate every feedback in the comments and would be happy if you also like && subscribe :)

NestJS is used in v7.
Nodejs is used in v12.
NPM is used in v6.

Main Frameworks:

Tools:
Рекомендации по теме
Комментарии
Автор

Thanks for creating this. Niche videos like this solve the time-consuming and non-sexy problems devs run into without getting enough recognition. Cheers.

tudorabw
Автор

nice work. Just bear in mind that as you already have built the project locally, you have the 'dist' directory in your local machine, so this approach works because you mount the whole already-built nest app into your docker container and you are able to debug because your 'localRoot' (i.e. your local 'dist') is being mounted in your remoteRoot (i.e. the runnin container)

anguinan
Автор

Thanks. You solved a problem for me that I'd been stuck on for hours: the volume mounting directory in docker-compose.yaml has to be the same as the working dir in the dockerfile (duh)

nickroach
Автор

Great work, mate! U saved my day! Best wishes, keep up!

nick_vento
Автор

Thank you so much for this video. I could not figure out how to connect my debugger to docker-container. Wasted so much time trying to figure it out.

miguelduarte
Автор

Thank you a million Bro! You saved my life!

ojosedirceu
Автор

Hello Thomas, my friend I'm starting a new project on this one today 12/02/22 and the hot reload simply refuses to work, I've followed your steps, other YouTubers and even tutorials on blogs on the internet, but nothing works, I wonder if you could release an updated video for version 9 of nest?

RaulAquino
Автор

Thanks for sharing this.
I happen to have done the same thing, that is a dockerized nestjs project on windows 10.
I felt that the development and hot reload was much much slower than it should be. My solution was to directly put my project on the wsl 2 user home folder or sub-folder. Then i just use the Remote - WSL extension for vs code. The rest of the development is the same but with a wsl terminal. There is even the added advantage that the npm packages of the local dev will be compiled for linux if installed outside of the docker container. The difference in speed is markedly obvious.

estranhokonsta
Автор

Great work! can you tell me how i can connect debug with intelij idea

nomaniqbal
Автор

the hot reload thing is not working for me

nutpiro
Автор

@Thomas Oliver I cloned your repository and made the changes you made to your docker file and compose file. Only difference for me was volumes in docker compose.yml because your volumes didnt work for me. I used volumes provided in another comment by anguinan: volumes:
- ./dist:/app/dist
- ./src:/app/src

Edit: my dockerfile for WORKDIR is : /thomas/src/app

How to change WORKDIR in dockerfile so that it matches my compose file? Please help, im stuck for days.

But when I started the application in docker by command: npm run start:dev and when i update the code base and change "hello youtube " to "hello bruno" the watch mode doesnt change the code for me . Can you please explain why ?

kanemay
join shbcf.ru