Nest-cli: start:dev is not working in docker

Created on 28 Jun 2020  路  2Comments  路  Source: nestjs/nest-cli

Bug Report

Current behavior

When running in docker with start:dev, the incremental compilation is started even if no file is changed.

$ docker run --rm -it -p 8000:80 image-name

Here is the log:

$ nest start --watch
[6:18:34 PM] Starting compilation in watch mode...

[6:18:38 PM] Found 0 errors. Watching for file changes.

[Nest] 37   - 06/28/2020, 6:18:39 PM   [NestFactory] Starting Nest application...
[Nest] 37   - 06/28/2020, 6:18:39 PM   [InstanceLoader] AppModule dependencies initialized +10ms
[Nest] 37   - 06/28/2020, 6:18:39 PM   [RoutesResolver] AppController {}: +4ms
[Nest] 37   - 06/28/2020, 6:18:39 PM   [RouterExplorer] Mapped {, GET} route +2ms
[Nest] 37   - 06/28/2020, 6:18:39 PM   [NestApplication] Nest application successfully started +2ms
[6:18:40 PM] File change detected. Starting incremental compilation...

Input Code

Dockerfile:

FROM node:14-alpine

WORKDIR /app

COPY package.json package.json
COPY yarn.lock yarn.lock

RUN yarn install

COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

COPY src ./src
COPY nest-cli.json ./
COPY tsconfig.* ./

EXPOSE 80

docker-entrypoint.sh:

#!/bin/sh
set -eo pipefail

exec yarn start:dev

If this step didn't fail, I would add the src folder as a volume to use during development.

Expected behavior

The application should run and rebuild shouldn't be triggered unless a file is really changed.

Possible Solution

Environment


Nest version: 7.0.0


For Tooling issues:
- Node version: v14.4.0
- Platform:  Docker

Others:
- Docker Desktop (MacOS): 2.3.0.3

All 2 comments

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.

Come on @kamilmysliwiec, I really understand that you want to keep issues clean but this was not a question to be dismissed like this. After hours, I found out this is an actual bug, not on nestjs but upstream, typescript.

Here is the relevant issue: https://github.com/microsoft/TypeScript/issues/37994

In case someone suffers, too, since the fix didn't make into the stable version yet, I switched to the typescript@next version temporarily to workaround.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andersbc picture andersbc  路  3Comments

jylin picture jylin  路  5Comments

xmlking picture xmlking  路  6Comments

alexbuczynsky picture alexbuczynsky  路  5Comments

victordidenko picture victordidenko  路  4Comments