#Docker compose always get nest not found
41 messages · Page 1 of 1 (latest)
If the @nestjs/cli package is in your devDependencies, it will not get installed when NODE_ENV === 'production'
The nest package is bot installed globally in the container. Actually, you don't even want that. Use node dist/main as your startup command. Also, you can use npm install --omit=dev to expliciy only install production dependencies without dev deps (that shoud be part of the dockerfile and NOT in the startup script btw)
Oh, or I'm mistaken and you only want to run it in a dev mode in the container?
I want to deploy it in pro
So dist folder should be enough. There is no need of the cli for running that
And where I have to do the npm install, in dockerfile or in compose?
The dockerfile. Also don't bind volumes that refer to the source files. The built docker image should have everything it needs to just run the app.
In local I achieve it to work, but in production server I get this error
@jagged sun @onyx totem @dense hearth Any idea? Is the same code
And with npm run start
Here's some studying material for you: https://www.youtube.com/watch?v=4q3br8jRSz4
In this video we will take a look at how to dockerize a typescript application. We will build a simple demo ExpressJs application and then setup all the necessary docker tooling to be able to run the application both in a development environment as well as a production environment.
Github 🎁:
https://github.com/Sanjeev-Thiyagarajan/docker-types...
Can we talk in private?
I'd prefer to keep the discussion public
ok
My isn't if it works or not. My problem now is that I have different behavior in local and in production. Docker is supposed to act always the same way right?
you mounted a volume with the application source on your local machine to the docker container. The volume contents is likely different on the prod machine.
I copied all. But ok, i will follow the video
btw don't mount volumes to the application source, only subfolders for output/input if need be. I've found it behaves funky when you mount a volume to a folder that includes the same file on the host as well as inside the container
what if you run node dist/main locally?
it starts
ha
your workdir is different in your dockerfile and in the compose
home/node/app vs home/app/node
Hm, strange
if u want we can see while I share the screen
With a simple container i can see the folders
@jagged sun
If I use the image name, instead of . in build, it works
@jagged sun It fails again 😦