[英]Containerzied React app and NGINX not serving on the localhost port I want
I have a containerized React app that I'm trying to test out building with webpack and serving the static generated files with the NGINX image, but it's not being displayed on the port I want locally.我有一个容器化的 React 应用程序,我正在尝试测试使用 webpack 构建并使用 NGINX 图像提供静态生成的文件,但它没有显示在我想要的本地端口上。 My WebPack file is outputting files in to a directory called dist so as you can see in my Dockerfile I'm going in to that directory and copying my files to the usr/share/nginx/html directory.
我的 WebPack 文件将文件输出到一个名为 dist 的目录中,因此您可以在我的 Dockerfile 中看到我将进入该目录并将我的文件复制到 usr/share/nginx/html 目录中。 Is there something else I'm missing in this file?
这个文件中还有什么我遗漏的吗?
Nginx 在端口 80 上提供服务,因此当您运行容器时,您需要在docker run
命令中将该端口映射到端口 3000:
docker run -d -p 3000:80 app-image
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.