Docker caching stopped working

Christian Geisler December 3, 2019

We are using the pre-defined docker cache from bitbucket pipeline.

Until about a month ago the caching worked like a charm and build times for our django backend were in the order of 1min. If we rebuild that same commit with the pipeline today we have a build time of 6min even if the cache is properly populated.

Has anybody experienced a similar behavior?

Here is our bitbucket-pipeline.yml file:

image: docker/compose:1.25.0-rc2-alpine

options:
docker: true

definitions:
steps:
- step: &build-test-django
name: Build and test of Django
caches:
- docker
script:
- docker-compose -f docker-compose.yml run django pytest
- step: &build-test-frontend
name: Build and test frontend
caches:
- docker
script:
- docker-compose -f docker-compose.yml run -e CI=true frontend bash -c "npm install && npm test"
services:
docker:
memory: 2048

pipelines:
pull-requests:
'**':
- parallel:
- step: *build-test-django
- step: *build-test-frontend
branches:
develop:
- parallel:
- step: *build-test-django
- step: *build-test-frontend
master:
- parallel:
- step: *build-test-django
- step: *build-test-frontend

1 answer

1 accepted

0 votes
Answer accepted
fpena-trileuco January 27, 2020

Same problem for us.

Christian Geisler January 27, 2020

Per support agent request – looks like you cannot use the same docker cache for both steps!

We tried using the docker cache for the frontend and the backend build in parallel. After removing the docker cache from the 'build-test-frontend' step. Caching for the backend is working again and the build times are reduced.

This is a workaround since ideally the cache would be used for the frontend and backend build.

Here is the updated section of the bitbucket-pipeline.yml file:

- step: &build-test-frontend
name: Build and test frontend
script:
- docker-compose -f docker-compose.yml run -e CI=true frontend bash -c "npm install && npm test"
fpena-trileuco January 27, 2020

Ok. Now that I understand your case in detail, I see that we aren't exactly in the same case. 

Anyway, thank you for the help!!

Like elopez-trileuco likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events