devcontainer
Answered
Transvaal lion posted this in #help-forum
Transvaal lionOP
i want to make webapp with nextjs, i have a vps with docker installed in it, and i don't want to install node in the server, can i do that using Dockerfile, docker-compose.yml and package.json?
25 Replies
But yes. You only need Docker installed, no need to install nodejs
Transvaal lionOP
thanks for reply, can i just use this https://github.com/vercel/next.js/blob/canary/examples/with-docker-compose/compose.dev.yaml docker compose without Dockerfile? i don't see the docker file inside this
Transvaal lionOP
ohh thanks i was blind
thank you very much
Transvaal lionOP
i did this, and it works, but too much files, i want a very basic and simple setup with only Dockerfile, docker-compose and package.json, is there is something simple like that?
i dont have an example for you but it is doable. well you need either another Dockerfile or another docker-compose specifically for development (if you want to run dev mode inside Docker too), but it is doable.
Transvaal lionOP
i'm tryed to do it 3 days now without success, ai make ms crazy
uh... learn how to write a dockerfile and how to write a docker-compose.yml file, then you should be able to do it
Transvaal lionOP
but now finaly i get it 😄
thank you very much
my problem was not with docker compose as i was familiar with it
the problem was with package.json, that's what drives me crazy
but now after your help with th compose file in the git, i want able to make very basic file 😄
oh, just stick with the default package.json, there isnt anything you need to do there to make it work
Transvaal lionOP
thnak you very very very much
package.json is not part of the deployment workflow
Transvaal lionOP
yes but it's mandatory? i have to specify that in Dockerfile,
well yeah, package.json is where you declare your dependencies so you must have it
optionally you should have the lockfile as well (package-lock.json, yarn.lock, pnpm-lock.yaml or bun.lockb depending on which package manager you use)
Transvaal lionOP
yes, only package-lock.json is optional
package.json is not needed for docker but needed for
npm install
which is what you absolutely need to run during the docker image buildTransvaal lionOP
correct, during the build i need only package.json, and package-lock will be generate with npm install
the lockfile is optional but still highly recommended because without it you could have different dependency versions in your vps which could cause different behaviours https://stackoverflow.com/a/66074027