docker build step to long in bitbucket pipelines

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

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... :)

Thanks for this!

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.

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

22,364 views 26 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you