So I have a pipeline that builds multiple docker containers from a single git repo. It looks something like this:
---
resources:
- name: resource-docker
type: git
source:
uri: https://github.com/$MYUSER/$MYREPO.git
branch: master
# docker-image resources
- name: first-container
type: docker-image
source:
repository: $MYUSER/first-container
- name: second-container
type: docker-image
source:
repository: $MYUSER/second-container
jobs:
# image-update jobs
- name: first-container-image-update
public: true
serial_groups:
- serial_lock
plan:
- get: resource-docker
serial: true
- put: first-container
params:
build: resource-docker/first-container-path
- name: second-container-image-update
public: true
serial_groups:
- serial_lock
plan:
- get: resource-docker
serial: true
- put: second-container
params:
build: resource-docker/second-container-path
The problem is that running a resource-docker
task is taking up a significant portion of system resources and rebuilding the containers from scratch on each commit to the master (which contains more code than just the docker containers).
I would like to make these tasks instead compare the old and new files used to build the containers, and only rebuild a container if there is a diff in the files.
Note: that separating the files out into different repos is an option I want to avoid.