Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

docker build step to long in bitbucket pipelines

JT October 19, 2017

In my node project's bitbucket-pipelines.yml i am using docker build for the image. That image is then pushed to my container registry. The thing is, the docker build step is taking to long, its consuming to much build minutes compared to my local machine when building the image.

I would just like to know if there is a way to make the step faster in bitbucket pipelines like possible caching of docker build process, maybe?

Thank you in advance :D

2 answers

1 vote
Ernesto Serrano June 20, 2018

You can increase the build time using the --cache-from feature, see an example:

 

pipelines:
default:
- step:
services:
- docker
script:
- export IMAGE_NAME=your-docker-hub/your-repo:$BITBUCKET_BRANCH
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
- docker pull $IMAGE_NAME || true
- docker build --cache-from $IMAGE_NAME -t $IMAGE_NAME .
- docker push $IMAGE_NAME

Avoid using the pipeline docker cache, only wastes time... :)

Oliver Bell June 23, 2018

Thanks for this!

Kyle Lee September 6, 2019

A little late but why is Bitbucket pipelines docker cache a waste of time? Haven't done enough testing but my instinct is that you are right.

For one pipe, it is not even using any build cache (which works locally).

How does `docker build --cache-from $IMAGE_NAME -t $IMAGE_NAME .` work though? Where is the cached stored? I assume it re-downloads the image each time and uses that as cache (which probably still saves a lot of time).

0 votes
gdelpino October 25, 2017

I second this. It seems like there is a missed opportunity to make the build process faster. Downloading the image is the step taking too long (I am just downloading node:8.2.1). Maybe bitbucket can add the TLS versions of node to their list of available images so it doesn't have to download them every time?

Definitely 10 minute build times can be a bit of a problem.

EmmanuelMoralesGonzalez March 12, 2018

did you find a solution? i 'm experienced the same issue :(

John Busciglio March 26, 2018

same problem here.  I chewed up 50 minutes and never even got to npm install..  

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events