Docker-compose in C.I. with cache?

Here is my .gitlab-ci.yml: https://gitlab.com/precognition-llc/aeonvera-ui/blob/registration-rework/.gitlab-ci.yml

My build works, but it’s really slow, and I know this is due to caching not happening.

I’ve read this thread: https://gitlab.com/gitlab-org/gitlab-ce/issues/17861

but I’m unsure if it’s even relevant to a docker-compose setup, as compose has its own naming conventions for docker images.

Has anyone figured out a way to run docker-compose tests?

In case anyone thinks ‘why not just use docker?’ – well, for server-side apps, it’s handy to have docker-compose manage the environment variables and extra services that a server may need to interact with.

For the linked .gitlab-ci.yml, I could just use docker, as my ember app doesn’t require additional services. But, I think figuring out a docker-compose solution is still valuable (I have a few other projects that have to use docker-compose)

Hi!

You can use cache_from.
Something like:

version: '3.2'

services:

  test:
    build:
      context: .
      dockerfile: Dockerfile
      cache_from:
        - test/test
    image: test/test

And then use the registry like a cache:

docker-compose pull
docker-compose build
docker-compose push
1 Like