简体   繁体   English

在单个容器中使用 node/express 对 VueJS 应用程序进行 Dockerize

[英]Dockerize VueJS app with node/express in single container

This questions must have been asked many times before but i can't find any solution that can help me solve my problem.这个问题以前肯定被问过很多次,但我找不到任何可以帮助我解决问题的解决方案。

I'm running VueJS application with Express/NodeJS as server and I know the best way is probably to separate them in 2 containers.我正在使用 Express/NodeJS 作为服务器运行 VueJS 应用程序,我知道最好的方法可能是将它们分开在 2 个容器中。 But how can I make this work in 1 container with multi-stage or any other way.但是我怎样才能通过multi-stage或任何其他方式使它在 1 个容器中工作。

Any tips would be appreciated!任何提示将不胜感激! Thank you!谢谢!

Run multiple services in a container在容器中运行多个服务

A container's main running process is the ENTRYPOINT and/or CMD at the end of the Dockerfile. It is generally recommended that you separate areas of concern by using one service per container.一个容器的主要运行进程是 Dockerfile 末尾的 ENTRYPOINT 和/或 CMD。通常建议您通过每个容器使用一个服务来分离关注区域。 That service may fork into multiple processes (for example, Apache web server starts multiple worker processes).该服务可能会分成多个进程(例如,Apache web 服务器启动多个工作进程)。 It's ok to have multiple processes, but to get the most benefit out of Docker, avoid one container being responsible for multiple aspects of your overall application.拥有多个进程是可以的,但要从 Docker 中获得最大收益,请避免一个容器负责整个应用程序的多个方面。 You can connect multiple containers using user-defined.networks and shared volumes.您可以使用用户定义的网络和共享卷连接多个容器。
If you need to run more than one service within a container, you can accomplish this in a few different ways.如果您需要在一个容器中运行多个服务,您可以通过几种不同的方式来完成。

Reference: https://docs.docker.com/config/containers/multi-service_container/参考: https://docs.docker.com/config/containers/multi-service_container/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 NX(反应和节点应用程序)进行 dockerize? - How to dockerize with NX (react and node app)? 多个域,单节点(快速)应用程序 - Multiple domains, single node (express) app 节点,Express API Azure 上的应用程序出现容器启动失败错误 - Node, Express API App on Azure giving Container Start Failure error 在本地-Nginx容器上的React App带有Node Express容器的代理 - On local - React App on Nginx container with proxy to Node Express Containers 无法在Windows的节点容器中运行示例Express应用 - Can't run sample express app in node container on Windows 无法在Centos7容器中公开Node Express应用程序的端口 - Can`t expose port for node express app in Centos7 container Dockerize React + Redux 应用程序运行 Node 服务器和 Webpack - Dockerize React + Redux app running Node server & Webpack 在单个 Azure Web 应用程序中具有 Angular 前端的 Node/Express 后端 - Node/Express Backend with Angular Front End in a Single Azure Web App 如何在Express for Node中重定向到单页Web应用程序 - How to Redirect to Single Page Web App in Express for Node 有没有办法通过快递将我的 MySQL 数据库 Dockerize 并将该容器托管在数字海洋上……等等? - Is there a way to Dockerize my MySQL DB with express and host that container on digital ocean .. etc?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM