How to run a nodejs script in a Docker container?

I’ve been running my application with PM2 all this time, but with Docker it no longer seems necessary. However, I can’t figure out how to run the script so that it runs continuously. In PM2, you can specify the script path in the configuration file:

module.exports = {
    apps: [
        {
            script: './build/index.js',
            ...
        },
    ],
};

And it will keep it running. Is there a similar alternative in Docker, or are there any third-party tools I can use for this purpose? Initially, I was planning to continue using PM2 for this, but as mentioned in this thread, Docker seems to offer alternatives without it. Another option I’m considering is using nodemon, but I believe there might be better solutions