#Docker compose always get nest not found

41 messages · Page 1 of 1 (latest)

pure plover
#

Hello,

I'm trying to deploy node in a docker container and I always get nest not found. What I'm doint wrong?

dense hearth
#

If the @nestjs/cli package is in your devDependencies, it will not get installed when NODE_ENV === 'production'

jagged sun
#

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?

pure plover
onyx totem
#

So dist folder should be enough. There is no need of the cli for running that

pure plover
jagged sun
pure plover
#

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

jagged sun
#

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...

▶ Play video
jagged sun
#

I'd prefer to keep the discussion public

pure plover
#

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?

jagged sun
pure plover
#

I copied all. But ok, i will follow the video

jagged sun
#

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

pure plover
#

By now this image builds ok

#

Current Docker compose

#

I get this

jagged sun
#

what if you run node dist/main locally?

pure plover
#

it starts

jagged sun
#

ha

#

your workdir is different in your dockerfile and in the compose

#

home/node/app vs home/app/node

pure plover
#

true

#

I get the same

#

Is true, the folder is empty

jagged sun
#

Hm, strange

pure plover
#

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

pure plover
#

@jagged sun It fails again 😦