[英]Deployed React App Shows a Blank Page and Console Returns Error 404
[英]React Flask app works in Docker container but returns 404 error when deployed to Cloud Run
将我的应用程序部署到 Google Cloud 时,我不知道问题出在哪里。 这里我在自己的系统上运行 Docker 容器:
$ docker run 829c6a550061
[2020-09-01 15:08:37 +0000] [6] [INFO] Starting gunicorn 20.0.4
[2020-09-01 15:08:37 +0000] [6] [INFO] Listening at: http://0.0.0.0:8080 (6)
[2020-09-01 15:08:37 +0000] [6] [INFO] Using worker: threads
[2020-09-01 15:08:37 +0000] [8] [INFO] Booting worker with pid: 8
当我单击“http://0.0.0.0:8080”时,它成功启动了该站点。 当我部署到 Cloud Run 时,它会在最后给出一个 URL 并说“在某某 URL 上提供 100% 的流量”,但是当我点击该 URL 时,它是一个 404 错误。 Cloud Run 说默认情况下应用程序侦听 8080。我错过了什么吗? 下面是我的 Dockerfile,我附上了 Cloud Run 日志的屏幕截图。
FROM node:13.12.0-alpine as react-build
WORKDIR /ChessKingsCouncil/react_frontend
RUN mkdir public src
COPY ./react_frontend/public ./public
COPY ./react_frontend/src ./src
COPY ./react_frontend/package.json ./
COPY ./react_frontend/package-lock.json ./
RUN npm install
RUN npm run-script build
FROM python:3.8.2
WORKDIR /ChessKingsCouncil/python_backend
ENV PYTHONPATH "${PYTHONPATH}:/app"
RUN pip install Flask
RUN pip install firebase-admin
RUN pip install gunicorn
RUN pip install termcolor
COPY ./python_backend ./
RUN mkdir build
COPY --from=react-build /ChessKingsCouncil/react_frontend/build ./build
ENV PORT 8080
CMD gunicorn --bind :$PORT --workers 1 --threads 8 app:app
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.