- 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
bff
and a front endfe
bff
is a Ruby 2.3.1 / Rails 5 application, API only.fe
is React SPA
- 2 docker images based on
ruby:2.3.1
image, one forbff
one 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
apt
dependencies - copy the whole
/bff
directory over - switch
WORKDIR
- run
bundle install
ENTRYPOINT
/CMD
- pull out
nginx:latest
- run
apt-get update && apt-get upgrade
- install build time and runtime
apt
dependencies - install node.js
npm install -g yarn
- copy the whole
/fe
directory over - switch
WORKDIR
yarn build
to minimise the artefects- copy
nginx.conf
ENTRYPOINT
/CMD
- use
alpine
instead - 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
ENTRYPOINT
more - utilise caching further with the price of more layers
- update system packages even if
Gemfile.lock
doesn't change