DEV Community

Discussion on: Tips on Building a Docker image (quickly) in a CI/CD Pipeline

Collapse
 
webreaper profile image
Mark Otway

Another great tip - if your docker image has other non-build dependencies (or transitive dependencies that you need to build before your app), have a separate base-image build that you only do when those deps change. Then your app build uses that as the base image.

For example, in my app (github.com/webreaper/damselfly) I need a bunch of unmanaged libs for linux to make GDI+ code work, and OpenCV etc, as well as ExifTool and a bunch of other apt-get packages. Instead of pulling/building all of that every time I build my app, I have a Damselfly-Base image with them all pre-populated that's used as the base image for my app's container.