Having an issue with NestJS and Docker here. Trying to run the development script using npm start: dev, but encountering a problem where the app runs fine but doesn't detect any changes in the source files, hindering the development process.
Here's a snippet from my docker-compose.yml:
messages:
image: c2c/messages:v1
command: npm run start:dev
build:
context: ./services/c2c-server-messages
dockerfile: Dockerfile
container_name: c2c_server_messages
depends_on:
- postgres
- nginx
networks:
c2c_net:
ipv4_address: 172.28.1.5
And the Dockerfile for my Nest app:
FROM node:10-alpine
WORKDIR /api/messages
ADD . .
RUN npm install
EXPOSE 3000
CMD ["npm", "run", "start"]
The npm start:dev script in my package.json:
"start:dev": "tsc-watch -p tsconfig.build.json --onSuccess \"node dist/main.js\"",
While the console output gives me this info, the app fails to pick up on file changes:
c2c_server_messages | 7:26:29 PM - Found 0 errors. Watching for file changes.
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [NestFactory] Starting Nest application...
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [InstanceLoader] TypeOrmModule dependencies initialized +63ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [InstanceLoader] AppModule dependencies initialized +2ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [InstanceLoader] TypeOrmCoreModule dependencies initialized +151ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [InstanceLoader] TypeOrmModule dependencies initialized +1ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [InstanceLoader] MessageModule dependencies initialized +2ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [RoutesResolver] AppController {/}: +8ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [RouterExplorer] Mapped {/, GET} route +6ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [RoutesResolver] MessageController {/messages}: +1ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [RouterExplorer] Mapped {/, POST} route +2ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [RouterExplorer] Mapped {/all, GET} route +2ms
c2c_server_messages | [Nest] 36 - 07/31/2019, 7:26 PM [NestApplication] Nest application successfully started +5ms