I am trying to define current stack in a docker-compose.yml to share with other developers in the project, so have the NestJS container started with:
npm run start:dev
which is defined in the package.json as:
NODE_ENV=development nest start --watch -- --inspect --max_old_space_size=1024
and in main.ts there is:
if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'prod') {
await app.listen(3001, '0.0.0.0');
console.log(`Application is in PRODUCTION mode running on: ${await app.getUrl()}`);
} else {
await app.listen(3001, '0.0.0.0');
console.log(`Application is in DEV mode running on: ${await app.getUrl()}`);
}
However, when docker compose up runs, the container outputs:
api-server-api-server-1 | Application is in DEV mode running on: http://127.0.0.1:3001
This of course results in no ability to access the service from the host at the ip/port since it's not even binding (and proven by looking at the netstat -an | grep 3001 from the host).
How can I expose this service appropriately?