如何使用docker-compose和Dockerfile构建项目的图像?

How to build an image of a project using docker-compose with Dockerfile?

我有一个使用docker-compose在本地开发中运行的项目。

作为Gitlab和部署的组织需求的一部分,应用程序需要构建到一个单一的Docker映像中。

我知道这可以通过在项目中添加一个Dockerfile来实现。

但是,我想知道,对于如何将一个通过docker-compose运行多个服务的项目和应用程序代码库包含到一个单独的映像中,并使用Dockerfile进行部署,是否有任何建议或建议,谢谢。

编辑:根据我所能收集到的,方法是用dockerfile从应用程序代码库构建一个新的映像,然后将它包含在部署环境的docker-compose.yml文件中?

编辑2:为混乱道歉。我刚到Docker,有点学习曲线!在这种情况下,似乎可以在Gitlab注册表中构建应用程序映像,然后将该映像包含在Docker Compose中进行部署,将尝试使用它。


(P)页:1(p)(P)a单一dockerfile is usually not enough to replace a whole containers orchestration made with docker-compose and is not necessarly a good choice.(p)About turning a EDOCX1 theocx1 penography 0 nic file to a dockerfile:(P)You can pass some informations from your EDOCX1 plography 0 welcome file to your EDOCX1 original 2(the command to run for instance),but that would't be equivalent and you can't do that with all the EDOCX1 diography 0 welcome file content.(p)(P)You can replace your EDOCX1 penographic 0 invalic file with commands lines though(as EDOCX1 genital 5 precisely to replace it).(p)(P)但(p)(P)Keep in mind that EDOCX1 penographic 6 and EDOCX1 commercial 5 commercial serve two whole different purposes.(p)

  • (P)EDOCX1是图像建筑的意思,用来界定制作你图像的步骤。(p)
  • (P)EDOCX1 is a tool to start and orchestra containers to build your applications(You can a d d some informations like the build context path or the name for the images you'd need,but not the dockerfile content itself).(p)

(P)So asking to"turn a EDOCX1 penographic 10x1 into a EDOCX1 penalty 8"isn't really relevant.(p)(P)That's more about turning a EDOCX1 genital 0 universal file into one(or several)command line(s)to start containers by hand.(p)(P)The purpose of EDOCX1 pental 5 silian is precisely to get rid of these command lines to make things simpler(it automates it).(p)一个单一容器中的多种工艺:(P)From the Docker Documentation:(p)布尔奇1(P)So you can if your entrypoint permits you to launch several processes,or if you use a supervision,but maybe that's not necessarly the best idea.(p)(P)伊迪特(p)(P)因为我没有为你清干净,这里是一个集装箱和一个图像之间的区别。(p)(P)You really should check this out and try to understand this before you working with docker since it's a very necessary thing to know.(p)