Docker构建/推送每次 - 是否实际的连续部署? [英] Docker build/push every time - is it practical for continuous deployment?

查看:203
本文介绍了Docker构建/推送每次 - 是否实际的连续部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果每天部署5-10次,完全重建和推送Docker镜像真的很实用吗?

Is it really practical to completely rebuild and push a docker image every time you deploy, if you are deploying 5-10 times a day?

我承认好处,如CircleCI的 Docker持续集成和交付中所述,即:

I acknowledge the benefits, as mentioned in CircleCI's Continuous Integration and Delivery with Docker, namely:


注意,Elastic Beanstalk还允许您部署Dockerfile和相关的源代码,而不是构建映像,但是在CircleCI上预构建映像并对其执行某种形式的验证

Note that Elastic Beanstalk also allows you to deploy a Dockerfile and associated source code instead of a built image, but pre-building the image on CircleCI and running some form of verification on it allows your deployments to be more deterministic because you remove the build environment as a variable that differs between test and production.

但是,我们完全支持您的部署,因此您的部署可以更具确定性,因为您将构建环境作为测试和生产之间的变量删除。内置webapp图像接近1GB一旦所有依赖和源代码都包括在内。我只是不知道如何实际部署高达200GB /月(即每天10次提交,不断部署),当几乎99%的不在构建之间改变。即它可能只是1k价值的HTML,JS或CSS改变添加功能。我喜欢一种方法,其中docker镜像包含很少改变的软件,其余的被压缩作为bundle的一部分。这仍然会导致一个自包含的部署文件(没有进一步的依赖需要下载),但大大减少构建时间和带宽。

However, our fully built webapp image is close to 1GB once all dependencies and source code are included. I just don't see how it's practical to be deploying up to 200GB/month (i.e. 10 commits daily, continuously deployed) when practically 99% of it does not change between builds. i.e. it might just be 1k worth of HTML, JS or CSS that's changed to add a feature. I would prefer an approach where the docker image contains rarely-changed software and the rest is zipped up as part of a bundle. This would still result in a self-contained deploy file (no further dependencies requiring download) but reduce build time and bandwidth substantially.

推荐答案

目前接受的方法是包括在机器映像中具有依赖性,操作系统等的基本Docker镜像。使用Docker镜像作为Dockerfile中的 FROM 行。这将利用Docker的图像图层,并只下载差异。

The currently accepted approach is to include a basic Docker image that has the dependencies, the operating system, etc within the machine image. Use that Docker image as the FROM line in your Dockerfile. This will take advantage of Docker's image layers and download only the differences.

您可能仍然要在子Dockerfile中安装依赖项,因为它们会随着时间的推移而改变,但是尽量将它们保存在基本映像中, 。

You may want to still install the dependencies in the child Dockerfile since they will change over time, but try to keep most of them in the base image so there's less to download.

这篇关于Docker构建/推送每次 - 是否实际的连续部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆