当前位置:网站首页>效率提升 - 鼓捣个性化容器开发环境
效率提升 - 鼓捣个性化容器开发环境
2022-07-01 21:47:00 【mariolu】
背景是我司有个具复杂的工程,这个工程引用了27次submodule,用cicd测试环境开发效率很慢,因为cicd上开启了构建前清理空间,每次编译都是一次巨量的git拉取过程,编译cache也会一同清空,所以弄一次编译,二三十分钟就过去了,而且还可能二三十分钟只是解决一个开发的编译错误。时间得不偿失。
一、Dockerfile描述文件
于是我有了想法。线上cicd上根据这份docker描述文件编译的
白话下这个描述文件,
- 去网上下载一份centos7.4的镜像,
- 在目录下把编译打包好的程序zip文件放到/data/app/approot目录下,
- yum安装一些允许或者必要的包
- 再执行后续的一些命令。
二、生成镜像image
好了根据这份文件,执行以下命令
sudo docker build -t fullfish/toucan -f ./Dockerfile .
-f指定了Dockerfile的路径,-t表示生成的image名字,
如果这些步骤都成功了,然后就可以用docker image ls查看到刚刚打包好的image
三、启动镜像
然后启动这个image,sudo docker run -d --rm -it --entrypoint bash fullfish/toucan
接着就可以用docker container ls查看到这个启动的container实例。
然后就可以用id或者names进入这个container,sudo docker exec -it 3bd8d0b98146 bash或者sudo docker exec -it silly_spence bash
然后这个container里面,我们把工程代码都git下载下来,再里面把整个编译环境都搞定。比如说我的这个工程
缺失了这些个必要的第三方组件,
其中一个比较有意思的是libstdc++-static,这个包其实很隐蔽,因为我的代码是静态编译libstdc++,所以即使镜像里面有libstdc++.so也是不行的。这个缺失会在代码链接库阶段的时候报错。另一个是gcc-c++,这个其实就是centos7的gcc4.8版本。
这样镜像包根据线下cicd环境centos7镜像包加入这些必须包和gcc4.8开发环境。
四、根据container生成新镜像
好了我也在这个Dockerfile完善了一些依赖库信息。接下来我要把这个image分享给同事,怎么弄呢。就是说把这个完善的container再生成image。然后同事就可以根据这个新image做他们自己的开发环境。
用docker commit提交这个id,
sudo docker commit 3bd8d0b98146然后用docker tag生成一个好记的名字
sudo docker tag 6e939bf3a45b toucan_dev接下来同事就可以愉快的使用新镜像toucan_dev了,用这个镜像包进入docker开发,就不用去依赖cicd上编译调试了
边栏推荐
- [commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial
- Slope compensation
- 【JetCache】JetCache的使用方法与步骤
- 灵动微 MM32 多路ADC-DMA配置
- 切面条 C语言
- 园区全光技术选型-中篇
- The correct way to set the bypass route
- 详解LockSupport的使用
- 内存导致的电脑游戏中显示hdmi无信号 从而死机的情况
- Recent public ancestor offline practice (tarjan)
猜你喜欢
![[intelligent QBD risk assessment tool] Shanghai daoning brings you leanqbd introduction, trial and tutorial](/img/ac/655fd534ef7ab9d991d8fe1c884853.png)
[intelligent QBD risk assessment tool] Shanghai daoning brings you leanqbd introduction, trial and tutorial

The second anniversary of the three winged bird: the wings are getting richer and the take-off is just around the corner

IDA动态调试apk

H5 model trained by keras to tflite

keras训练的H5模型转tflite

分享一个一年经历两次裁员的程序员的一些感触

PyTorch磨刀篇|argmax和argmin函数

Relationship and difference between enterprise architecture and project management

Fully annotated SSM framework construction

YOLOv5.5 调用本地摄像头
随机推荐
内存导致的电脑游戏中显示hdmi无信号 从而死机的情况
Redis配置与优化
[intelligent QBD risk assessment tool] Shanghai daoning brings you leanqbd introduction, trial and tutorial
[STM32] stm32cubemx tutorial II - basic use (new projects light up LED lights)
GaussDB(DWS)主动预防排查
MySQL empties table data
linux下清理系统缓存并释放内存
【MySQL】explain的基本使用以及各列的作用
20220701
PyTorch磨刀篇|argmax和argmin函数
CSDN购买的课程从哪里可以进入
Sonic云真机学习总结6 - 1.4.1服务端、agent端部署
Sonic cloud real machine learning summary 6 - 1.4.1 server and agent deployment
CNN convolution neural network principle explanation + image recognition application (with source code) [easy to understand]
Qtreeview+qabstractitemmodel custom model: the third of a series of tutorials [easy to understand]
性能测试计划怎么编写
利用SecureCRTPortable远程连接虚拟机
比较版本号[双指针截取自己想要的字串]
Object memory layout
地图其他篇总目录