Github Action docker-compose cache

Hey there,

first of all github actions are really really great!

We us docker-compose to create a complete development stack for every developer. When we use github action every docker-compose up -d will take up to 10 Minutes because the images have to be downloaded every time.

I saw the new actions/cache repository but there is no working example on how to cache docker-compose.

Anybody of you have a working example?

name: Main

on: [push, pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: "Checkout Project"
      uses: actions/checkout@v1
      with:
        fetch-depth: 1

    - name: "Docker Build"
      run: docker-compose --log-level INFO up -d --build

    - name: "Docker Logs"
      run: docker-compose logs
7 Likes

Hi @fabiankoestring , Thanks for bringing up this topic. Even I am looking for any working example for using  actions/cache, However,  I am not able to find any

2 Likes

How about the list at https://github.com/actions/cache/blob/master/examples.md ?

Saw that list but there is no example for docker-compose. No one seems to work on this example and personaly i dont have a clue about it.

I’m looking for the exact same thing and I’m not able to find anything.

We run our systems using docker-compose and GitHub actions has to download the images and install the package dependencies every time. It’s really ineficcient.

Did you find any solution?

Thanks!

You probably will need to make a .tar of the images and use the cache to store and retrieve, like:

step: action@cache

step: script that sees the directory and untar the images

docker-compose up -d

step: tar the images

step: post action@cache

People do this in CircleCI and Travis CI all the time. Just need to look the cache max size,  400mb per file and 2GB total per repository.

3 Likes

For the package dependencies you need to create a volume pointing to the host and use action@cache to cache this directory.

Sounds good! I’ll give it a try.

Thanks!

1 Like

Yea sounds good. Please share your results! :+1:

Thanks. I have a similar problem.

“step that sees the directory and untar the images”

huh? Which directory? What images? 

did you find any clue yet?

I am also looking for a solution for docker-compose especially since I run a graphql-gateway for a mesh of microservices.