#Docker and Custom server.js

9 messages · Page 1 of 1 (latest)

dusk gate
#

Is anyone aware of a way to deploy using Docker and standalone mode, which is recommended and also use our own custom server.js? Standalone mode creates its own server.js, and my custom one does not seem to be compatible.

high agate
#

I'm on mobile right now,if you head at next.js repo and click on the examples folder, you lol find a folder called with-docker. It uses standalone mode

#

Ah custom server.js

#

You would have to replace the server.js file generated by next.js. you can try a local build with standalone to figure out the path of that file

dusk gate
#

@high agate Yeah I am able to get my server.js to replace the one that is created, but that doesn't seem to work correctly, it will not start up after that. Both examples work find on their own, but cant seem to get both to work together.

#

@high agate This is the error that I end up getting

Error: Cannot find module 'app/node_modules/next/dist/server/next.js'. Please verify that the package.json has a valid "main" entry
high agate
#

Interesting, I ll try this tomorrow myself.

high agate
wet belfry
#

this is causing express not found error