It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Docker caching stopped working

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

Same problem for us.

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"

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
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

593 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you