[英]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!
谢谢!
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.