Do you want to use some caching in docker-compose/docker in your CI to speedup things? You probably want to!
Given something like:
FROM php:...WORKDIR /appCOPY composer.* ./RUN composer installCOPY . ./
You have seen that before right? If your composer.lock and composer.json do not change, you have no new dependencies to install and so you definitively want to skip the composer install on every build step of your pipeline.
But this does not work like that! Somehow docker will not resolve the glob in the copy command above and cannot cache it entirely. It’ll installs everytime.
You have to change to:
COPY composer.json composer.lock ./
Struggling to make docker-caching work in your pipeline? There a tons of more tricks, should I continue? Clap for this article :) Thanks :)