- A very trivial commit to master would trigger a pipeline that takes 20+ minutes.
- The feelback loop was very slow.
- Long running pipeline is blocking other pipelines
- The broadband funnel consists of a backend-for-frontend
bffand a front endfe bffis a Ruby 2.3.1 / Rails 5 application, API only.feis React SPA
- 2 docker images based on
ruby:2.3.1image, one forbffone forfe - Every time the pipeline runs, 2 docker images will be built.
- It used to about 20 mintues to build both images
- pull out
ruby:2.3.1 - run
apt-get update && apt-get upgrade - install build time and runtime
aptdependencies - copy the whole
/bffdirectory over - switch
WORKDIR - run
bundle install ENTRYPOINT/CMD
- pull out
nginx:latest - run
apt-get update && apt-get upgrade - install build time and runtime
aptdependencies - install node.js
npm install -g yarn- copy the whole
/fedirectory over - switch
WORKDIR yarn buildto minimise the artefects- copy
nginx.conf ENTRYPOINT/CMD
- use
alpineinstead - combine to 1 docker image
- have a base image for time-consuming yet stable operations (apt-get, bundle install etc.)
- build the SPA artefect outside docker (e.g. in ci)
- delete build time dependencies
- non-root user
- use
ENTRYPOINTmore - utilise caching further with the price of more layers
- update system packages even if
Gemfile.lockdoesn't change