我正在使用 npm 构建一个 React Javascript 应用程序,并希望将其部署在 docker 上。
当我在本地运行应用程序时:
npm start
这一切都很好。
但是当我构建一个 Docker 镜像并测试它时,我得到了以下错误:
$ docker run react-app
> keycloak-react@0.1.0 start /
> react-scripts start
ℹ 「wds」: Project is running at http://172.17.0.2/
ℹ 「wds」: webpack output is served from
ℹ 「wds」: Content not from webpack is served from /public
ℹ 「wds」: 404s will fallback to /
Starting the development server...
Dockerfile 看起来像:
FROM node:latest
COPY ./keycloak-react .
RUN npm install typescript
RUN npm install node-sass
RUN npm install sass
RUN npm install fibers
RUN npm install
EXPOSE 3000
CMD [ "npm", "start", "run", "--host", "0.0.0.0"]
我不知道该怎么做任何想法?
最佳答案
我刚刚修复,让添加 stdin_open: true 到 docker-compose 来修复它。
链接信息:https://github.com/facebook/create-react-app/issues/8688
关于node.js - Docker react 应用程序 : 404s will fallback to/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61506475/