Skip to content

[React-Scripts] v3.4.1 fails to start in Docker #8688

@timcosta

Description

@timcosta

Describe the bug

I updated from react-scripts@3.3.0 to react-scripts@3.4.1 and when I attempted to restart my Docker container using the new version it exited with code 0.

Recreating core-ui_web_1 ... done Attaching to core-ui_web_1 web_1 | web_1 | > core-ui@0.1.0 start /app web_1 | > react-app-rewired start web_1 | web_1 | ℹ 「wds」: Project is running at http://172.24.0.6/ web_1 | ℹ 「wds」: webpack output is served from web_1 | ℹ 「wds」: Content not from webpack is served from /app/public web_1 | ℹ 「wds」: 404s will fallback to / web_1 | Starting the development server... web_1 | core-ui_web_1 exited with code 0 

This is all the logs had, but running docker-compose ps showed an exit code of 0. I tried running with/without react-app-rewired to rule that out as an issue, but the only thing that solved the issue was downgrading to ~3.3.0 again.

One weirdness I see that is different from 3.3.0 and 3.4.1 is the webpack output is served from line is blank in 3.4.1 but says / in 3.3.0.

Did you try recovering your dependencies?

I ran a fresh Docker rebuild with no cache using node:erbium as the base image to ensure there was no corruption. No luck.

Which terms did you search for in User Guide?

Docker, exit code 0.

Environment

Ran in my docker container to ensure the output is accurate.

➜ dc run web npx create-react-app --info npx: installed 99 in 7.075s Environment Info: current version of create-react-app: 3.4.1 running from /root/.npm/_npx/6/lib/node_modules/create-react-app System: OS: Linux 4.9 Debian GNU/Linux 9 (stretch) 9 (stretch) CPU: (4) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Binaries: Node: 12.13.1 - /usr/local/bin/node Yarn: 1.19.1 - /usr/local/bin/yarn npm: 6.12.1 - /usr/local/bin/npm Browsers: Chrome: Not Found Firefox: Not Found npmPackages: react: ^16.12.0 => 16.12.0 react-dom: ^16.12.0 => 16.12.0 react-scripts: ^3.4.1 => 3.4.1 npmGlobalPackages: create-react-app: Not Found 

Steps to reproduce

  1. Install CRA with RS@3.4.1
  2. Run in docker container
  3. Exits with code 0

Expected behavior

I expected the server to start.

Actual behavior

The server exited with status code 0 and no output after Starting the development server...

Reproducible demo

All CRA settings are left as their default. No CLI flags or env vars other than NODE_ENV=development.

Here's my Dockerfile:

# create base image with all packages, proper entrypoint, and directories created FROM node:erbium AS base # install any packages we need from apt here RUN apt-get update \ && apt-get install dumb-init # set entrypoint to `dumb-init` as it handles being pid 1 and forwarding signals # so that you dont need to bake that logic into your node app ENTRYPOINT ["dumb-init", "--"] # all of our code will live in `/app` WORKDIR /app # using the base image, create an image containing all of our files # and dependencies installed, devDeps and test directory included FROM base AS dependencies COPY package*.json ./ RUN npm set progress=false \ && npm config set depth 0 \ && npm i COPY ./config-overrides.js ./ COPY ./public ./public COPY ./src ./src # if you have any build scripts to run, like for the `templated-site` flavor # uncomment and possibly modify the following RUN command: # RUN npm run build # keeping all of the bash commands you can within a single RUN is generally important, # but for this case it's likely that we want to use the cache from the prune which will # change infrequently. # test running image using all of the files and devDeps FROM dependencies AS test USER node ENV NODE_ENV=test # use `sh -c` so we can chain test commands using `&&` CMD ["npm", "test"] FROM dependencies AS development # expose port 3000 from in the container to the outside world # this is the default port defined in server/manifest.js, and # will need to be updated if you change the default port EXPOSE 3000 CMD ["npm", "start"] # release ready image, devDeps are pruned and tests removed for size control FROM development AS release RUN npm prune --production \ rm -rf lib/**/*.spec.js 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions