【发布时间】:2021-09-09 00:47:42
【问题描述】:
我正在尝试在 openshift 中部署 Angular 应用程序。我在项目中只有一个带有 dockerfile 的 Angular 项目,它执行 ng build --prod 和 npm start 来启动应用程序。问题是我看到它在 localhost 内部而不是 openshift 主机中运行。因此,我在点击 openshift url 时在浏览器中收到“应用程序不可用”。请支持纠正它。
下面是 Pod 的日志
exmaple-ui@0.0.0 start /ng-app
> ng serve --host 0.0.0.0 --port 4200
WARNING: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.
Binding this server to an open connection can result in compromising your application or
computer. Using a different host than the one passed to the "--host" flag might result in
websocket connection issues. You might need to use "--disableHostCheck" if that's the
case.
** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **
Date: 2020-02-26T06:08:37.782Z
Hash: dc7eff7d77f7a5fbef4e
Time: 81197ms
chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 285 kB [initial] [rendered]
chunk {main} main.js, main.js.map (main) 97.8 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 236 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 3.61 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 7.4 MB [initial] [rendered]
[34mℹ[39m [90m「wdm」[39m: Compiled successfully.
【问题讨论】:
-
你能粘贴你的docker文件,服务yml,路由yml吗?
标签: openshift