Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run start failing in kubernetes/skaffld #8739

Closed
mmoron opened this issue Mar 28, 2020 · 5 comments
Closed

npm run start failing in kubernetes/skaffld #8739

mmoron opened this issue Mar 28, 2020 · 5 comments

Comments

@mmoron
Copy link

mmoron commented Mar 28, 2020

Describe the bug

I try to run npm run start inside of a docker container with kubernetes and skaffold. Everything compiles as expected, but after npm run start is run the app keeps restarting.

This happens for react-scripts version 3.4.1. After changing to version 3.2.0 everything is working as expected.

my package.json:

{
  "name": "sample",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "publish": "docker build . -t test/test"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Did you try recovering your dependencies?

Yes. It is not working for new create-react-app istallations.

Which terms did you search for in User Guide?

skaffold
docker
kubernetes

Environment

I'm not sure whether it is relevant as the problem is happening inside of docker container, but here it is. Also it might be important that I'm doing this using minikube on windows.

current version of create-react-app: 3.4.1
running from C:\Users\maciek\AppData\Roaming\npm\node_modules\create-react-app

System:
OS: Windows 10 10.0.18362
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 12.16.1 - C:\nodejs\node.EXE
Yarn: Not Found
npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.18362.449.0
Internet Explorer: 11.0.18362.1
npmPackages:
react: ^16.13.1 => 16.13.1
react-dom: ^16.13.1 => 16.13.1
react-scripts: 3.4.1 => 3.4.1
npmGlobalPackages:
create-react-app: Not Found

Steps to reproduce

(Write your steps here:)

  1. run npx create-react-app
  2. add Dockerfile:
FROM node:12-alpine

WORKDIR /app
EXPOSE 3000
CMD ["npm", "run", "start"]

COPY package* ./
RUN npm ci
COPY . .
  1. add skaffold.yaml
apiVersion: skaffold/v1beta15
kind: Config
metadata:
  name: test
build:
  artifacts:
  - image: test/test
    sync:
      infer:
      - '**/*.js'
      - '**/*.jsx'
      - '**/*.css'
deploy:
  kubectl:
    manifests:
    - deployment.yaml
portForward:
- resourceType: deployment
  resourceName: test
  port: 3000
  1. add deployment.yaml:
apiVersion: v1
kind: Service
metadata:
  name: test
  labels:
    app: test
spec:
  selector:
    app: test
  ports:
  - nodePort: 30915
    port: 8080
    protocol: TCP
    targetPort: 3000
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test
  labels:
    app: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: test
        image: test/test
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 3000
  1. run skaffold dev

Expected behavior

app should start listening on port 3000 inside a docker container. When run with reac-scripts 3.2.0 it works as expected:

image

Actual behavior

app keeps restarting:

image

@mimecuvalo
Copy link

I'm seeing the same issue. I think it's a regression due to: #7203 The process exits and then the container is restarted.

@mimecuvalo
Copy link

Oh, looks like this is a dupe of #8688

@mmoron
Copy link
Author

mmoron commented Apr 2, 2020

I does look like a duplicate. Thanks for pointing it out.

@stale
Copy link

stale bot commented May 2, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label May 2, 2020
@stale
Copy link

stale bot commented May 7, 2020

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed May 7, 2020
@lock lock bot locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants
@mimecuvalo @mmoron and others