到目前为止,我已经构建了映像并将其部署到 AWS EC2。但我想用
serve -s build
Run Code Online (Sandbox Code Playgroud)
在生产模式下为应用程序提供服务。我在本地做的,显然一切似乎都很好..我明白了..
?????????????????????????????????????????????????????? ?? ? ? ? 服务!? ? ? ? - 本地:http://localhost:5000 ? ? - 在您的网络上:http : //192.168.1.91 : 5000 ?? ? ? 将本地地址复制到剪贴板!? ? ? ?????????????????????????????????????????????????????? ??
然后页面进入..但是当我尝试向 api 发出请求时,我得到 404。
我想知道 react 构建是如何工作的,以及我需要做什么才能将其置于生产模式。还有,dist 文件夹是干什么用的?
这是我的 Dockerfile:
FROM node
#Create app directory
WORKDIR /app
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
#Install dependencies
RUN npm install
RUN npm install …Run Code Online (Sandbox Code Playgroud)